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
Fabric-Based Computing Enables Optimized Hyperscale Data Centers

Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.

Learn More

Sponsored by AMD

White Paper
Red Hat White Paper: Using an Open Source Framework to Catch the Bad Guy

Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6

Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.

Learn more about catching the bad guy in this free white paper.

Learn More

Sponsored by DLT Solutions