in reply to Re^2: Not Catching Signals While Program is Prompting with IO::Prompt
in thread Not Catching Signals While Program is Prompting with IO::Prompt
2008. It doesn't look like anythings going to change any time soon.
Frankly, the module is overkill for what it does. A simple loop that prompts and re-prompts until the input matches a regex is pretty trivial to write.
sub promptTill{{ local $\; print "$_[0]: "; chomp( my $input = <STDIN> ); redo unless $input =~ $_[1]; return $input }} print promptTill( 'Yes/No', qr[^(?:y(?:e(?:s)?)?|n(?:o)?)$]i );;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Not Catching Signals While Program is Prompting with IO::Prompt
by gg48gg (Sexton) on Jun 12, 2012 at 21:42 UTC | |
by BrowserUk (Patriarch) on Jun 12, 2012 at 23:29 UTC | |
by gg48gg (Sexton) on Jun 13, 2012 at 16:32 UTC | |
|
Re^4: Not Catching Signals While Program is Prompting with IO::Prompt
by locked_user indoposting (Initiate) on Jun 08, 2012 at 22:26 UTC | |
by BrowserUk (Patriarch) on Jun 08, 2012 at 23:04 UTC |