Subject: | -require checks ignore for -default value |
Date: | Wed, 06 Sep 2006 16:59:31 +1000 |
To: | bug-IO-Prompt [...] rt.cpan.org |
From: | Geoff Crompton <geoff.crompton [...] strategicdata.com.au> |
Hi,
If you supply a -default value, the -require checks are bypassed.
I'm using IO-Prompt-v0.99.2. For example, the following code accepts the
default, even thougth the default doesn't meet the first require about
lenght, and may not meet the second require if the user already exists.
prompt('Enter clients user name: ',
-default => 'geoff',
-require => {
# Require username to be at least 6 chars long
'Username to short, enter another one:' => sub { m{ .{6,}
}x; },
# Require usename does not already exist
'Username already exists, enter another one:' => sub { !getpwnam($_); },
},
);
--
Geoff Crompton
Debian System Administrator
Strategic Data
+61 3 9340 9000