Programming the Network with Perl: A Book Review

by Rick Bourassa

Title: Programming The Network With PerlAuthor: Paul BarryPublisher: Wiley Computer PublishingISBN: 0-471-48670-1

I wish I had found Programming The Network With Perl two years ago. It really has opened my eyes to the power of Perl.

The first chapter gives a brief overview of the basics of Perl. Users who are new to Perl will probably want to refer to a general purpose book, such as O'Reilly's Learning Perl, before diving into the rest of this book. And Programming The Network With Perl does provide tons of references and links to other resources in print and on the Web.

The second chapter is my favorite chapter. It explains how to use the NetPacket and PCAP libraries to make Perl capture network traffic. A few months ago, I spent a long time adding some enhancements to TCPDUMP so it would collect statistics on the data it was capturing. I now would have preferred to create that program in Perl rather than C; it could have been done quicker and easier. Reading this chapter really made me think about all kinds of possibilities for network statistic collection, as well as other network traffic monitoring tools.

The third chapter covers socket programming, explaining how to create client/server applications, when to use TCP verses UDP and what problems might arise. The examples in this chapter also gave me plenty of ideas for potential applications and provided insight into how streaming audio and video applications could be built.

The forth chapter covers protocols and how to work with them in Perl. The example in this chapter is a simple web browser that parses HTML from a web site. Although the web browser itself is not overly useful, you could use this example and write a script that would periodically check a web site to make sure no one has tampered with it. It also covers the SMTP and Telnet modules. The Telnet module could be used to write a script that would automatically back up network element configurations, such as routers and switches.

The fifth chapter covers management, and the examples show how to use ping and traceroute in a Perl script. It also shows how to used SNMP, with an example that monitors uptimes from a group of routers. The possibilities this set of modules offers are endless. If you're like me, you probably have been sitting at your computer at one time or another thinking, "Wouldn't it be great if my NMS (Network Management System) did this?" Well, you could probably make it happen if you use these modules.

The last chapter covers mobile agents, which still is a highly experimental area. I did not find the examples in this chapter to be as useful as the ones offered in the other chapters. The only thing I could think of was, maybe, a C compiler application that went out to the other machines on a network and looked for ones with low utilization. The program then could be compiled on a machine that wasn't busy. Mobile agents also may have uses in clustering.

The appendices at the end of the book contain a lot of useful information. They offer essential Linux commands, a quick vi reference, a diagram of the network used when writing the book and packet captures of different types of network transactions.

Programming The Network With Perl is quite different from other Perl books I have read. Many are written as reference books, whereas this one is written more like a textbook, with exercises at the end of the chapters. The author, Paul Barry, lectures at The Institute of Technology at Carlow, Ireland.

I found this book to be very useful, with a lot of great, easy-to-apply examples throughout. I would highly recommend this book to anyone interested is working on the network with Perl.

Rick Bourassa is a network consultant in Calgary, Alberta, Canada. He has been using Linux since 1997. He is a father of twins and spends most of his free time involved in kids' soccer and hockey.

Load Disqus comments