Functions that accept multiple argument combinations are not always a good idea: they are more difficult to document, difficult to implement leading to spaghetti code and so they also are more bug prone, and sometimes corner cases become ambiguos.
Prototypes are not so bad, you don't need them most of the time, but in some ocassions they provide the syntactic sugar required to make a function much more friendly. I specially like the & proto that allows to write functions that work as grep {...} @foo;. My advice is: use them only when there is an obvious gain.
Carp::croak is your only way to report fatal errors in modules (well, except internal errors that should be reported with die), but Carp::carp is not so useful. If some function accepts optional arguments then it's ok for the user to not pass them and no warning is required; on the other hand, if some required arguments are missed, croak!.
Anyway, if you use Carp::carp, remember to let the user deactivate the warnings using warnings::register and warnings::enabled() in your module.
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.