I know you put a lot of work into this, so I am putting
some work into style suggestions back. Please take this
as constructive criticism because that is how it is meant:
- Don't use "my" for things you are using as global
variables. Instead "use vars". This gives more
context to what you mean, and the habit will avoid some
problems if you ever use mod_perl.
- Keep lines down to 80 characters. Perl has no rule
about how many lines a single line of code takes, so you
can and should break a line of code across several actual
lines for readability. This makes it easier to read and
easier to print.
- Your "scalar $#array+1" construct is redundant.
Either use ($#array+1) or use "scalar @array".
- If you are going to check parameters then use Carp,
and confess to the problem, not die. That will give you
a stack backtrace which makes the actual mistake far easier
to track down. (In general aim to have every error message
have enough information for debugging.)
- Put the expected action first. For instance in
write_file do an "or die" because you don't expect to.
(Suggestion straight from perlstyle.)
- In write_file you can and should use a hash slice
instead of writing the hash lookup 5 times.
- Personally I don't like your formatting for reasons
explained in Code Complete. Namely that it right-shifts
very fast, and it is a maintainance nightmare if anyone
changes a line of code. (Because then you have to change
several others.) Instead I suggest using whatever your
standard block indent is.
Oh, and thanks for putting so much effort in. :-)
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- 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.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||