Mastering Perl
brian d foy
O'Reilly Media, 2007
ISBN-13: 978-0-596-52724-2
US$ 39.99
Rating: 4/5 (very good)
In recent years, O'Reilly pace regarding the publishing of Perl-related books has slowed down quite a lot. This is likely not because of O'Reilly fault, but it's probably due to the fact that Perl is a mature language for which there is a lot of literature which is still up-to-date. For instance, the 3rd edition of Programming Perl was published in 2001 and is still a reliable reference for the current version of the language - even though that is going to change a bit within a few days, with the release of perl 5.10.
Anyway, it seems there's still to write about Perl as a language as opposed to projects or software powered by Perl, and that it what the book is about: the language and how to use it at best. It's a collection of tips, best practices and suggestions, and can fit into the same category as two other O'Reilly titles: Perl Hacks and Perl Best Practices.
Part of this book is devoted to the usual (and important) areas: writing secure and high-performance programs, debugging, error handling, logging and documentation writing. For all of this, several options are usually described by the author, and they range from rolling your own solution using the core perl compiler to using CPAN modules to automate part of, if not all, the work. For example, the section regarding the profiling of Perl programs explains first what profiling is about and illustrates a general approach at the task, and then how to profile database code with DBI::Profile; it then goes to the full-featured solution involving Devel::DProf and closes with suggestions on how to write your own profiler module.
This book can help you organize your applications better. For instance, do you embed your configuration variables at the top of your programs or in an external Perl module? Think of a different approach by reading chapter 11, and start using configuration files (which can overridden with command-line options) as the whole Unix world does - there are plenty of formats to choose from. Using Windows? Use the Windows Registry. Using MaxOS X? Use the plist format. You can do all of this with ready to use modules, and this book explains you how to get started with this.
The most interesting parts of the book lie in it's "niche" chapters, which explains aspects of Perl which are not needed by most programmers, but of which every programmer would surely benefit. Have you always thought that working with bits was something for mad assembly or C++ coders? Wrong! Chapter 16 will introduce you to binary numbers, bit operators and vectors. You might also want to take a look at chapter 6 which teaches you how to make your code clear and how to de-obfuscate other people's code (all right, obfuscation is a virtue, but there should be limits ;-)).
All in all this book can be very useful to improve the way you use Perl (the language) and perl (the compiler), and is a worth reading, which then becomes a nice reference.

