Touching the camel

Paul asked about getting back
to maintaining some Perl code after an absence of a few years. Since I
do a lot of Perl, here are some of the time-savers that I can’t live
without:

  • search.cpan.org allows you
    to search all the publicly-available modules on CPAN. There are few problems in Perl that
    haven’t been at least partially solved by a CPAN module. At the very
    least, make sure any web scripts use CGI.pm appropriately. I still see
    hand-rolled code that parses CGI arguments, never as well as CGI.pm would
    do.
  • PerlMonks is where you go
    to ask about your Perl problems, and find solutions. It’s worth
    learning a bit about the search options so you don’t ask a very old
    question again. This is me on
    PerlMonks, incidentally.
  • The Perl FAQ,
    included in the documentation as /perlfaq[1-9]?/. The Perl Cookbook is
    basically just the Perl FAQ on paper. Nice to hold, but you can’t
    search it the same way you can with perldoc -q <keyword>.

I would always advise Perl programmers to be
lazy
. Not slothful, but spend a little time seeing if someone
has solved your problem before. Thus you can turn many routine
programming jobs into a small matter of configuration.

I would also advise learning some of the idiomatic Perl tricks,
like ‘... or die ...‘, inline
if/unless, careful use of
undef, and list operators like map and
grep. It’s not just because you’re likely to meet them in
everyday code, but they’re very convenient. Once you start to miss
them in other languages, you’ll know that you are One Of
Us
.

1 comment

Leave a comment

Your email address will not be published. Required fields are marked *