Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Effective Perl programming (2nd ed.): ways to write better, more idiomatic Perl
Hall J., McAdams J., Foy B., Addison-Wesley Professional, Upper Saddle River, NJ, 2010. 504 pp. Type: Book (978-0-321496-94-2)
Date Reviewed: Oct 15 2010

Perl is certainly one of the most popular scripting languages ever: the Perl archive (CPAN) has over 16,000 libraries, modules, and applications that cover almost anything anyone might want to program, and Perl has driven many Web sites and influenced languages and programs since its beginning.

Perl is powerful and often very concise, but, as with all such languages, it can be difficult to write Perl code and even more difficult to read it. This book suggests ways to write better Perl code, as well as ways to incorporate recent additions and improvements to the language.

The book’s 13 chapters cover major topics, and each chapter is subdivided into related “items,” which makes for a total of 120 items, averaging a reasonably digestible four pages in length. Each item ends with a “Things to Remember” section that briefly summarizes the major points.

The chapters cover such topics as Perl basics, programming idiomatically, regular expressions, Unicode, testing, and CPAN. The chapter on testing, which has a number of hints on how to test your programs (including test-driven development), and the chapter on warnings, which shows how to use Perl’s warning system to find suspicious code, are particularly noteworthy.

This review covers some of the items presented in the book, to give readers a taste of what the book has to offer. Item 63, “Be Careful with Circular Data Structures,” briefly describes Perl’s reference counting approach to memory management and explains how to handle data structures that may contain cycles (and hence use up memory). Item 47, “Use Hashes to Pass Named Parameters,” discusses how to use mappings (hashes) to simulate function arguments defined by keywords. Item 43, “Understand the Difference Between My and Local,” considers two different scoping mechanisms for variables and their subtle differences.

Item 74, “Specify Unicode Characters by Code Point or Name,” covers ways to use either code points or character names to specify Unicode characters, enabling the programmer to describe Unicode characters either numerically or with an expressive name (such as “Skull and Crossbones”). Item 96, “Measure Your Test Coverage,” talks about the benefits and pitfalls of checking that your tests actually cover all of your code. Item 103, “Handle Exceptions Properly,” shows how to handle error conditions in your programs without a built-in extension mechanism, and Item 67, “Mitigate the Risk of Public Code,” discusses some of the potential problems with using CPAN modules, including how to minimize such problems.

Many of the items cover features that have recently been added to Perl, with information on why these are enhancements, how best to use them, and how to incorporate them in older code.

This is not really a style guide, though it does contain a great deal of advice on Perl style; instead, the items are nice snippets of advice, from someone who knows the language well. As a result, this book is ideal for casual browsing.

This book will probably be most useful to reasonably experienced Perl programmers. Beginners and novices may find the book a bit off-putting--some of the code is quite terse, and many of the problems are more appropriate for readers who are familiar with the language.

Reviewer:  Jeffrey Putnam Review #: CR138492 (1108-0787)
Bookmark and Share
  Reviewer Selected
Featured Reviewer
 
 
Perl (D.4.9 ... )
 
 
General (D.1.0 )
 
 
Language Constructs and Features (D.3.3 )
 
Would you recommend this review?
yes
no
Other reviews under "Perl": Date
Programming perl
Wall L., Schwartz R., O’Reilly & Associates, Inc., Sebastopol, CA, 1991. Type: Book (9780937175644)
Feb 1 1992
Learning perl
Schwartz R., O’Reilly & Associates, Inc., Sebastopol, CA, 1993. Type: Book (9781565920422)
Sep 1 1994
Software engineering with Perl
Dichter C., Pease M., Prentice-Hall, Inc., Upper Saddle River, NJ, 1995. Type: Book (9780130169655)
Oct 1 1996
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy