Is anyone aware of any modules that will check subroutine arguments?  I can
think of two similar features of Perl, but neither is quite right:

1. Prototypes (perlsyn) - put something like ($$@) after your subroutine
declaration - but doesn't work for object methods and a few other cases.
Plus, doesn't give you the ability to name the arguments and doesn't support
argument-based overloading.

2. Getopt::Long - check for argument value types, illegal arguments, etc. -
but doesn't allow for "mandatory options" (sounds like an oxymoron, but very
common when passing arguments in a hash form to a subroutine) or validating
nested data structures.

I'm often having to add a half dozen lines of code to every subroutine to
perform argument validation and I'd like to offload it once and for all into
a CPAN module.  Has anyone written or seen such a beast?  I haven't, so I've
started writing it... but then, what to call it?  My working title is
ArgsChecker.pm but it should be put into a hierarchy - Data:: perhaps?

-- 
Check out my LEGO blog at http://www.brickpile.com/
View my photos at http://flickr.com/photos/billward/
Follow me at http://twitter.com/williamward

Reply via email to