I am searching for a module that I expect should exist, but I'm not finding it. I see things that touch the edge, but don't really do what I'm seeking. Hopefully someone can point me the right way...
I am looking for a module for use with a terminal-based application that allows me to "get input" and provide validation parameters. For example, I'm expecting a module that would let me do something roughly like this:
or maybe$results = getInput( -prompt=>"Enter a number between 1 and 10: ", -type=>INTEGER, -LTE=>10, #less than or equal to -GTE=>1, #greater than or equal to -maxTries=>10);
or maybe even@results = getInput( -prompt=>"Pick one or more of the following:\n", -type=>LIST, -list=>["apple", "banana", "carrot"], -allowMultiple, -maxTries=>10);
$results = getInput( -prompt=>"Enter a username: ", -type=>STRING, -minLen=>3, #minimum length -maxLen=>15, #max length -restrictTo=>sub{/[A-Za-z0-9_@.-]+/} # the idea is to be able to pass a regex to validate -maxTries=>10);
I'm expecting the module to prompt the user, get the input, and validate it before returning a result (or results). I wouldn't expect it to cover all possibilities, but if it could cover the most common types of input data, that would be great.
data validators for CGI exist, but this would be more interative - when the user screwed up, they would be asked again.
Does something like this exist?
Thanks! - Paul
In reply to terminal input & data validation by pfaulstich
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |