



package Debian::DebConf::Element::Noninteractive::Select;
use strict;
use Debian::DebConf::Element::Noninteractive;
use vars qw(@ISA);
@ISA=qw(Debian::DebConf::Element::Noninteractive);


sub show {
	my $this=shift;

	my @choices=$this->question->choices_split;
	my $value=$this->question->value;
	$value='' unless defined $value;
	my $inlist=0;
	map { $inlist=1 if $_ eq $value } @choices;

	if (! $inlist) {
		my @choices=$this->question->choices_split;
		if (@choices) {
			$this->question->value($choices[0]);
		}
		else {
			$this->question->value('');
		}
	}
	
	return $this->question->value;
}

1
