No such thing as a small change | |
PerlMonks |
Re: Validating incoming CGI form databy zakb (Pilgrim) |
on May 02, 2003 at 12:35 UTC ( [id://254975]=note: print w/replies, xml ) | Need Help?? |
Your validation tests look reasonable. One optimisation would be to use an array for the error messages, like so:
...which means you don't need to maintain a flag. Looking on CPAN, I see CGI::Validate which appears to a a Getopt style validator and Params::Validate which may be useful. Update:Podmaster suggested Data::FormValidator, which is what I was trying to find. Update2: I left the & in there because that's what the supplicant had - now removed. For reasons why not to do this, see perlsub. Basically, with the &, the argument list to a sub is optional and you will get the @_ array visible at the time of calling in the subroutine.
In Section
Seekers of Perl Wisdom
|
|