home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / perl5 / Debconf / Element / Editor / Multiselect.pm < prev    next >
Encoding:
Perl POD Document  |  2009-03-24  |  916 b   |  40 lines

  1. #!/usr/bin/perl -w
  2. # This file was preprocessed, do not edit!
  3.  
  4.  
  5. package Debconf::Element::Editor::Multiselect;
  6. use strict;
  7. use Debconf::Gettext;
  8. use base qw(Debconf::Element::Multiselect);
  9.  
  10.  
  11. sub show {
  12.     my $this=shift;
  13.  
  14.     my @choices=$this->question->choices_split;
  15.  
  16.     $this->frontend->comment($this->question->extended_description."\n\n".
  17.         "(".gettext("Choices").": ".join(", ", @choices).")\n".
  18.         gettext("(Enter zero or more items separated by a comma followed by a space (', ').)")."\n".
  19.         $this->question->description."\n");
  20.  
  21.     $this->frontend->item($this->question->name, join ", ", $this->translate_default);
  22. }
  23.  
  24.  
  25. sub value {
  26.     my $this=shift;
  27.  
  28.     return $this->SUPER::value() unless @_;
  29.     my @values=split(',\s+', shift);
  30.  
  31.     my %valid=map { $_ => 1 } $this->question->choices_split;
  32.     
  33.     $this->SUPER::value(join(', ', $this->order_values(
  34.             map { $this->translate_to_C($_) }
  35.             grep { $valid{$_} } @values)));
  36. }
  37.  
  38.  
  39. 1
  40.