The Devil's Advocate is good - the term comes from a church official appointed to research and present arguments against a proposed sainthood to ensure that the case *for* that sainthood is as watertight as possible :-)
I also posted this to the London Perl Mongers list, and from the feedback there, it seems that I wasn't quite as clear as I should have been. I see this as being a way to auto-generate the repetitive simple tests that I hate writing - exactly the ones that are needed for the example I gave. Any more complex method still needs all those tests to make sure that it is getting at least part of its argument sanity-checking correct. I do not propose that any such mechanism should completely obviate the need to write some tests by hand.
Even if I use Params::Validate or Class::Contract I'd still need to write those sorts of tests, just to check that I've used those modules correctly.
Your point about it maybe making the module harder to read is a good one, although one which can - I hope - be solved by choosing the right syntax.
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.