I rate the Params::Validate module very highly. (Thank you, Dave Rolsky.)
I've been using Params::Validate for a couple of months now, for a large project we're working on, and I've found it to be outstanding. Some things we like about it:
- The interface is reasonably easy to understand, and the power it gives is very flexible.
- It verifies all kinds of things: types (isa), interfaces (can), array refs, hash refs, regular expressions (use it with Regexp::Common!).
- In addition, you can write your own validators.
- In addition, you can turn it off (that is, turn the validation into a no-op) in production code, if you don't like the performance penalty.
- The documentation is quite clear.
- We've found that the validate(@_, ...) statements at the top of our functions form a very useful kind of API documentation. (I've been thinking about a way to automatically turn these statements into POD for documenting APIs.)
It might be overkill depending on your application, but if you have a group of developers working together on something, it provides very a clear consistent way to enforce your expectations for a function's inputs.
| [reply] [d/l] [select] |
| [reply] |