Looking at the post in question, I'll guess that John is using prototypes to validate the number of arguments passed into each sub at compile time. I can certainly understand the desire to do that. I've even done that in the past. But I found that the misfeatures of Perl 5 prototypes outweighed this desirable effect (see the reference article for the full story on those misfeatures).
Now I only use prototypes for making compile-time constants and to emulate map's and grep's ability to take bare blocks as code references (and this latter use is quite rare and really only gives a very minor benefit of not having to see "sub" in front of each block).
Making compile-time constants is really the only use of prototypes that I can recommend.
BTW, I check the arguments passed into subroutines rather thoroughly, inside the subroutine, at run time. And I prefer to have test suites that validate the code paths so that this validation is effective before going into production, even though the checking isn't done at compile time. Since Perl uses a lot of late binding, checking subroutine arguments at compile time often just isn't possible.
(but my friends call me "Tye")
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||