home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / perl5 / Debconf / Element / Noninteractive / Select.pm < prev    next >
Encoding:
Perl POD Document  |  2006-07-24  |  602 b   |  36 lines

  1. #!/usr/bin/perl -w
  2. # This file was preprocessed, do not edit!
  3.  
  4.  
  5. package Debconf::Element::Noninteractive::Select;
  6. use strict;
  7. use base qw(Debconf::Element::Noninteractive);
  8.  
  9.  
  10. sub show {
  11.     my $this=shift;
  12.  
  13.     $this->question->template->i18n('');
  14.     my @choices=$this->question->choices_split;
  15.     $this->question->template->i18n(1);
  16.     my $value=$this->question->value;
  17.     $value='' unless defined $value;
  18.     my $inlist=0;
  19.     map { $inlist=1 if $_ eq $value } @choices;
  20.  
  21.     if (! $inlist) {
  22.         if (@choices) {
  23.             $this->value($choices[0]);
  24.         }
  25.         else {
  26.             $this->value('');
  27.         }
  28.     }
  29.     else {
  30.         $this->value($value);
  31.     }
  32. }
  33.  
  34.  
  35. 1
  36.