Book review: Mastering Perl 2nd edition

The second edition of Mastering Perl by brian d foy has just been published by O’Reilly. We took a look at the new version to see what’s changed and to find out what it really means to become a Perl master.

The road to mastery

Perl is a deceptively deep language: a novice can be productive in Perl within minutes, yet it takes years of practice to understand all of Perl’s features and shortcomings. brian d foy knows this, and he prefaces Mastering Perl with the explanation that the journey to mastery will involve self-study and experimentation, and working with and learning from many different Perl programmers. What follows in the book is a tour-de-force of advanced Perl programming subjects intended to set the reader on the road to mastery and equip them with the knowledge they need to advance their own skills further.

What’s in Mastering Perl

Mastering Perl covers a lot of ground and you can find a complete listing of chapters here. In every chapter I learned something useful, amazing or just plain cool about Perl. There were too many to mention them all, but a few highlights for me were:

  • The advanced regular expressions coverage, which culminates in writing a regex grammar (chapter 1)
  • In-depth coverage of taint, including how to circumvent it (chapter 2)
  • Writing your own Perl debugger (chapter 3)
  • Fixing other people’s subroutines by wrapping them (chapter 9)
  • Writing/reading external data with Sereal (chapter 13)
  • Extending the modulino concept to work for testing (chapter 17)

Mastering Perl is also a pleasure to read: brian d foy’s writing style is light hearted but professional, opinionated but reasoned. There is a good balance between code and words: concepts are introduced and explained without verbose prose and often the code examples do the talking.

Every chapter is self-contained: you won’t find yourself thumbing back through previous chapters to understand concepts discussed later in the book. And because of it’s modular structure, you can dive into the topics that interest you most and return to the remainder later on.

Content changes

The content of the new edition has been refreshed and beefed-up; it’s about 50 pages longer than the first time around. Every chapter has been updated and several have been extensively revised. A complete list of changes is available however the chapters with the most changes are:

  • The Advanced Regular Expressions chapter now covers recursion, grammars and other advanced regex features, culminating in Randal Scwartz’ JSON parser.
  • Secure Programming Techniques has new sections on symbolic references and preventing SQL injection with DBI. The Safe module is also covered.
  • The Detecting and Reporting Errors chapter updates the Fatal content with autodie, and introduces TryCatch.
  • The data formats of the Data Persistence chapter have been reorganized into Perl specific data storage and Perl agnostic data storage. New material has been added on JSON, Storable’s security issue, and Booking.com’s Sereal.

Style changes

The covers for the first and second editions are shown above. Style-wise O’Reilly has given Mastering Perl a spring clean. The cover title lettering has changed from Garamond to URW Typewriter, and the family of vicuñas has undergone a North Korean-style airbrushing, with the (presumably) troublesome second fawn removed entirely. I like the new cover, it feels cleaner and more modern but stays faithful to the Perl tradition with the blue background and camel-related animal on the cover. Beyond the cover, the book’s pages have not changed in style at all, with the same fonts and spacing used throughout.

Conclusion

Mastering Perl is enjoyable, informative and a worthy successor to Intermediate Perl. It equips the reader with a whole host of advanced tools and approaches for doing more with Perl now, whilst opening the doorway towards true language mastery.

The second edition of Mastering Perl is available to buy now from O’Reilly and Amazon (affiliate link).

Enjoyed this article? Help us out and retweet it!


This article was originally posted on PerlTricks.com.

Tags

David Farrell

David is a professional programmer who regularly tweets and blogs about code and the art of programming.

Browse their articles

Feedback

Something wrong with this article? Help us out by opening an issue or pull request on GitHub