Handle the case where the user hits Ctrl+D during input, and the case where the user piped a file into us and the file was too short.

This commit is contained in:
ian%hixie.ch 2001-11-10 21:53:49 +00:00
Родитель 9d72a19ae8
Коммит d2161e155f
1 изменённых файлов: 10 добавлений и 4 удалений

Просмотреть файл

@ -99,11 +99,17 @@ sub createArgument {
my $value = $term->readline(''); # (the parameter passed is the prompt, if any)
# if we cached the input device:
# $term->addhistory($value);
if ($value eq '') {
# use default
$self->setArgument(@_);
if (defined($value)) {
if ($value eq '') {
# use default
$self->setArgument(@_);
} else {
$self->setArgument($argument, $value);
}
} else {
$self->setArgument($argument, $value);
# end of file -- give up with this argument and then switch to batch mode
$self->SUPER::createArgument(@_);
$self->setArgument($argument, 1);
}
}
}