Ovid wrote:
This is simple, but I'm tired of rewriting it.  Params::Validate can
handle it, but I don't want to fire up a diesel engine when this is all
I need.

Not sure if it's much lighter than Params::Validate, but a quick CPAN search points out Params::Check, which looks similar but with fewer bells and whistles. A quick look at the docs and code suggests you're not going to get much closer to your desired functionality and still be general enough for use by others. As with Params::Validate, you still have to write a specification indicating defaults and required arguments, but that's necessary even to do your own hand-rolled checks.

It's almost embarrassing to upload a Hash::HasKeys module to the CPAN,
but I rewrite this code *all* the time (and always forget about "die if
extra_keys()").  Before I embarrass myself by writing and uploading
something so simple and special-purpose, tell me there's something out
there already ...

Another option is to code a "new subroutine" macro into your editor that sticks it in for you from a template. (Quicker to delete if not needed than type it in.) I find that very useful in general as I stick in my Pod documentation template at the same time, too.

Regards,
David

Reply via email to