First of all, a disclaimer: I know “larsen” (Stefano Rodighiero) not just as an
ex-colleague (he is one of the most respected senior programmers at DADA in
Italy), or through the Italian Perl
community, but also as a good friend.
But of course, those were excellent reasons to look forward to his book: an
introduction to Perl in a pocket series of roughly the same format and price
point as the UK Teach Yourself
series. The community’s perl.it website lists
various resources including tutorials and books in English and Italian, but till now
they haven’t recommended an introductory book in Italian. I think that could be about
to change.
Modern Perl good practices
I’ve seen a lot of criticism of introductory books for propagating the kind of
cowboy Perl that gives the language a bad name. Right from the first chapter,
Larsen introduces:
- CPAN for installing modules
- make test
- the Perl Community: where to find out more, get help, and improve your skills
- strict and warnings
- perldoc
He continues with this throughout: every chapter finishes with a list of
PODs and other resources to learn more. Variables are my‘d and code
is well formatted. Small sections going into good practices are dotted
strategically throughout the text, rather than consigned to an unread appendix:
for example, commenting and POD are detailed by page 55.
Teaching
The first half of the book, Chapters 2-4 cover basic string and array
operations, control structures (with foreach covered before C-style
for, references and subroutines, scope, context, subroutine
references, map/grep (with an example on Schwartzian
Transform) and exceptions.
The book also covers Perl 5.10 features like say (which it uses
throughout) and given/when.
This is obviously quite a whistlestop tour, but is clearly structured,
with concepts introduced as they are needed, and with explicatory
diagrams where helpful.
Chapters 5-6 introduce packages and OO programming. While it’s a short
overview, it covers the bases with inheritance, DESTROY, AUTOLOAD
(though is that a good thing? ;-), and some good practices like Module::Starter
and Class::Accessor.
Chapter 7 is a nice 25-page section on Regular Expressions with helpful diagrams,
examples and reference tables. Pleasingly, he finishes off by mentioning
Regexp::Common and cases not to use regexes for (HTML::TokeParser)
Finally, Chapter 8 takes us through Perl and the outside world. This is a mere
10 or so pages on file system tasks, and the same again split between CGI and
GUI programming. Given the importance of Perl for sysadmin glue and web
programming, this could be considered the book’s principal (only?) weakness.
On the other hand, trying to teach these disciplines in a short introduction
would make it a completely different book, and would have left out the
excellent introduction to the core matter. The interested reader who has
absorbed the contents of the book will have a much better base to learn the
next steps in whichever direction they need to go, so on balance, this is very
much the right decision.
But it doesn’t quite stop there. The appendix lists many main books like the
classic O’Reilly Camel Book
Conway’s
Object Oriented Perl,
Dominus’s
Higher Order Perl
etc.
It also gives a short guide to how to choose between the multiple modules
available on CPAN, and a brief overview of some useful modules and frameworks:
(Catalyst, TT etc.) Even if you disagree with some of the
featured choices (I did ;-) at least you know that the student has enough
pointers to learn better for themselves: as if to confirm that point, the book
ends with a 2-page reminder on the Perl community and the resources it offers.
Look and feel
Briefly, the typography is excellent, very clean and easy to read. The
diagrams are well laid out, and my only minor quibble are the little grey icons
which are unattractive and hard to distinguish from each other (they each have
a different symbol and apparently have distinct meanings, but I ended up
parsing them as “interesting note”). There are some oddities with punctuation
that lead me to suspect the editorial proofreading may not have been especially
thorough? Likewise, there are some minor errors in the diagrams on regexes,
which is a shame as those are otherwise very useful for a learner.
Conclusion
I think it’s excellent news for the state of Perl in Italy that this book has
been published. For a mere EUR 7.90 an Italian reader can now pick up a
compelling and thorough introduction to Perl in their native language.
Apparently it is in general release in Italian bookshops, otherwise you can
buy it online from one of the links on
the Pocket Perl site.