Perl Annotated Archives

 in
The book is full of clearly explained code.
  • Author: Martin Brown

  • Publisher: Osborne/McGraw-Hill

  • E-Mail: customer_service@mcgraw-hill.com

  • URL: http://www.osborne.com/

  • Price: $49.99 US

  • ISBN: 0-07-882557-1

  • Reviewer: Paul Dunne

This is a fine book and a good resource for learning Perl. The subtitle, “Code with Commentary”, is apt. The book is full of clearly explained code. Studying such annotated examples of practical code is an ideal way to learn a language or increase one's knowledge of a language. The author takes a cross-platform approach, which is nice to see. Even though most of the examples are inevitably UNIX-based, some code is also demonstrated for fixing NT and Macintosh problems. The usual CD with code examples is included. One minor annoyance is the lines are terminated with “CRLF”, but I suppose it's easier for Linuxers to deal with this than for those using NT to handle bare newlines.

The book is divided into four parts. It begins with “Text Processing”, which also serves as a basic introduction to Perl. This section starts by rounding up the usual filters, then examines simple file manipulating, and concludes with various types of text database work. After that, “Networking and E-mail” does a good job of illustrating and explaining Perl's excellent support for network programming. Part 3, “World Wide Web”, covers the ground one would expect: HTML munging and CGI scripts. The CGI coverage ranges from simple examples to an entire on-line shopping application. Finally, “Administrator's Toolkit” supplies a useful set of tools for systems and network administration. All in all, 11 chapters, with over a hundred clearly and closely explained scripts—there is nothing I can find fault with here.

I have one issue to raise, however. That is, “everything with Perl” is not always the best way. While one can hardly fault a book about Perl for taking this approach, I would still like to see more emphasis on how Perl can co-operate with existing UNIX utilities. For example, my ISP uses dynamic IP addressing, so when I need to find out what my IP address is this time, I use a little shell script that reads as follows:

ifconfig | grep ppp -A1 | domain.pl | head -1

Where domain.pl is the following script:

#!/usr/bin/perl -n
while (m/(([-a-zA-Z0-9]+\.[-a-zA-Z0-9]+)(\.[-a-zA-Z0-9]+)*)/g) {
    print "$1\n";
}
I know this doesn't cover all cases, but it works where required. I guess I could have implemented the whole pipeline in Perl; but for me, and I suspect many other UNIX users, it is easier just to bolt a few tools together than to write a program, even in a language as easy to get started in as Perl. Why reinvent the wheel? Much better to use Perl as part of the UNIX toolkit, not to replace it.

In conclusion, as Perl is best-known as the “glue” that holds many web sites together, this book, if aimed at any specific audience beyond Perl learners and users, it is aimed at the web site administrator or programmer. However, it is well worth reading by anyone interested in Perl.

Paul Dunne (paul@dunne.ie.eu.org) is an Irish writer and consultant who specializes in Linux. The only deadline he has ever met was the one for his very first article. His home page is at http://www.cix.co.uk/~dunnp/.

______________________

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState