then I iterate over the keys in the hash (ie.$param{'name'}) (thereby ignoring any parameters passed that I don't care about), make sure it is defined if $validationHash{"name"}{"status"} eq "required" otherwise return undef etc. then make sure that it looks like a "string" with a routine that runs a regexp match and finally, return a value $validationHash{'name'}{'outputsub'}->($param{'name'}) as what should be inserted into the database.%validationHash = ( "name" => { "regexp" => "string", "status" => "required", "outputsub" => \&massage; }, "phone" => { "regexp" => "phone", "status" => "optional", "outputsub" => \&mungephonenum, }, );
Needless to say, I would love to hear about nice ways of validating input and even better, ways of constructing SQL statements given such input (I'm considering using DBIx::Recordset for the latter, but I've done enough work already that I might have to come back to it at another time).
BTW, the first solution given worked very well and I am
using it successfully, thanks.
-Adi
In reply to Re: Re: How do I construct a reference to a builtin function?
by adram
in thread How do I construct a reference to a builtin function?
by adram
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |