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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.