Subject: | get_reply: "default" isn't really optional |
According to the docs (for get_reply)
default
The default answer -- This is the answer picked if the user just hits "enter" or if $AUTOREPLY is set to true. This parameter is optional.
This really isn't optional. There's basically two problems:
Pressing enter with no input, without default.
Pressing enter with no input, where the allow-handler returns 0.
In the former case, it'll warn on uninitalized values when adding it to the terminal history.
In the latter case, it'll pass an undefined value to check() in Params::Check, as well as warn on the former. :)
Should be easy enough to fix (atleast the former case, that I can do myself), good job on the module, though! It's quite handy! :)
Example code:
my $result;
# Press enter without any input:
$result= $term->get_reply(prompt => 'Test!');
Use of uninitialized value in length at /usr/local/share/perl/5.8.7/Term/UI.pm line 141.
# Press enter without any input; no warning.
$result = $term->get_reply(prompt => 'Test!', default => 'Foo');
# Press enter without any input:
$result = $term->get_reply(prompt => 'Test!', allow => sub { 0; });
Use of uninitialized value in length at /usr/local/share/perl/5.8.7/Term/UI.pm line 141.
Use of uninitialized value in string at /usr/local/share/perl/5.8.7/Params/Check.pm line 342.
Kindest regards, Jørgen.