I definitely agree that you should take advantage of Perl's rich syntax, even though I lean towards a verbose code style myself. The main issue I had with your meditation was about constructor arguments, and that was already addressed by Moritz.
I'd still like to comment on the bit about debugging. I tend to shuffle any logic for debugging into a sub, and invoke that sub whenever I need something dumped:
# Skipping boilerplate pragmas ...
use constant DEBUG => 1;
sub debug {
if (DEBUG) {
say STDERR (ref $_[0]) ? Dumper $_[0] : $_[0];
}
}
debug("Something is on fire");
debug([ qw(fire famine flood) ]);
This way I can easily change what I mean when I say debug - print to STDERR, log to a file, dump to a database, summon the remote controlled sky writing airplane, whatever. It's really just another opportunity to avoid copy and paste coding.
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:
- 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
Outside of code tags, you may need to use entities for some characters:
| |
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.
|
|