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

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