Author: Peter Scott
Publisher: Addison Wesley
Reviewed by: Dave Cross
A quote on the front cover of this book says "if you code in Perl then you need to read this book". That's a pretty bold claim to make. It made me think of the hyperbole on covers of books that claim to teach you to program in Perl in just a few days. But this book is published by Addison Wesley, who are a well respected technical publisher of technical books and the quote is from Adam Turoff who certainly knows what he's talking about when it comes to Perl programming. So in this case the claim isn't hyperbole. The book really is one that I want every Perl programmer to read.
Perl gets a lot of bad press from people who claim that it encourages people to write unreadable code. Whilst there's certainly a lot of very bad Perl code out there I think that's more a sign that it's used by a lot of people who don't know how to program than a reflection on the language itself. And that's where this book comes in. It assumes that you are familiar with the syntax of Perl but that you've never really been shown how to use it effectively. Which is a situation that many Perl programmers find themselves in.
Perl Medic is actually targetted at people who have to maintain older Perl code written by someone else, but I think that the information it contains is just as useful to anyone coding in Perl. Peter Scott has a lot of experience in writing Perl and in training other people to write Perl and the distillation of that experience and knowledge into these 300-odd pages mean that there are few Perl programmers who won't pick up something useful from this book.
The main emphasis in the book is on increasing the maintainability of code. The techniques are wide-ranging. I particularly enjoyed the examples of refactoring programs and the coverage of using modules from CPAN. Two other very good sections are the one on antipatterns in chapter 4 and the one on cargo cult programming in chapter 6. Together these sections give a programmer a number of easy to recognise quick wins when improving existing code and a checklist of things not to do when writing new code.
There are a couple of niggles. I've already mentioned that I think the book has been slightly mis-targetted and that it should have been aimed at anyone writing Perl code. The other problem that I had was that the medic analogy that runs through the book gets a bit strained at times. But these are only minor and they shouldn't prevent you from adding this book to your library.
In fact, all in all, the quote on the front cover is pretty accurate.