Params::Validate::Dependencies

Params::Validate is a very useful module, which lets you easily enforce rules such as "the 'foo' parameter to the 'bar' subroutine should be an arrayref". It also has some very basic support for dependencies - eg, that the 'baz' parameter must always be used in conjunction with the 'bar' parameter.

But for a problem I had, it didn't go far enough. So I've extended it. Params::Validate::Dependencies (Github link; not yet on the CPAN) extends the validate() method to add support for things like "must have exactly one of 'alpha', 'beta' or 'gamma', or both of 'foo' and bar'".

I would appreciate if some kind person could take a look over the code and tests and tell me if they're any good, and also let me know if the documentation makes sense.

3 Comments

Thanks I will take a look.
Is this something on the lines of Moose::Role for non Moose packages?

Nice. I submitted a patch to P::V a few years back to add mutually exclusive parameters (see bug 5701) but it wasn't accepted; would you be able to incorporate some of those ideas in your work?

Leave a comment

About David Cantrell

user-pic I'm in yur test resultz analyzn yr failz