Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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.


In reply to Re: Re: validating function input by talkasab
in thread validating function input by bobdeath

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (10)
As of 2024-04-18 08:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found