January 2005 (Vol. 6, No. 1)
1541-4922/05/$31.00 © 2005 IEEE
Published by the IEEE Computer Society
Published by the IEEE Computer Society
A Cornucopia of Perl Techniques
|Structure and content|
PDFs Require Adobe Acrobat
Web, Graphics & Perl/Tk
By Jon Orwant
Want to dive into Perl pools to explore Perl programming pearls? Then Web, Graphics & Perl/Tk is definitely a good resource for you. This book is the second volume in the Best of the Perl Journal series (the other volumes include Computer Science & Perl Programming and Games, Diversions & Perl Culture). Unlike many textbooks, these books aren't step-by-step guides but anthologies of articles from the Perl Journal. Jon Orwant, a famous member of the Perl community, edited all three books. He's the founder and publisher of TPJ and a best-selling author.
This volume comprises 39 articles handpicked and reworked by Orwant himself, who worked on them day and night. The articles' authors are all Perl gurus. Some of them are the creators of the most frequently used Perl modules; for example, Doug MacEachern developed mod_perl. Guided by such first-rank spiritual mentors, readers will find a royal road to wisdom. Now, let's get down to the basics.
Structure and content
Perl is a premier scripting language on the Web because most CGI (common gateway interface) programs are written in Perl. However, you can also use Perl as a rapid-prototyping language and "glue" language to make different systems fit together. Orwant recognizes Perl's debt to the Web and includes these important contents.
The 22 articles in Part 1 describe different aspects of how to apply Perl to the Web. The authors discuss both server-side (CGI, mod_perl) and client-side (LWP—Library for WWW in Perl) techniques. Some specific techniques, such as writing HTML parsers and Web spiders, are impressive and instructive. Owing to these articles' original publication dates, they don't cover several important issues, such as Web services and client-side Web plug-in scripting. Even so, this part will still help you develop a deeper understanding of how to get the most out of the Web.
Part 2, the most distinctive section in this book, presents nine articles on graphics. (Many other Perl books don't present any graphical material.) The first article demonstrates how to glue the Glueplot graphing program into a CGI program. The next two talk about how to use a graphics draw library. Then, Alligator Descartes introduces coupling Perl with OpenGL, and Mark Jason Dominus explains an amazing ray-tracing technique. Gimp, Glade, and Gnome panel applets are the following topics. In the last, most challenging article, Marc Lehmann describes how to frame-grab video in real time. I think the material presented in this part plays an important role in practical Web applications. For example, you can use the Perl package GD-Graph3d to plot 2D or 3D graphs dynamically. Using Perl for graphics programming provides an alternative to traditional C or C++ programming.
Part 3 consists of eight articles about creating, editing, and modifying GUIs using Perl/Tk, an object-oriented Perl extension that provides a general collection of widgets. The first article, by Steve Lidie, is a good introduction to Perl/Tk fundamentals. After that, several articles describe the use of specific widgets. However, a lack of some deeper topics, such as self-drawing in Perl/Tk, weakens this part somewhat. It's still a good beginning, even though it's short. Interested readers can find other related books to sharpen their skills, such as Mastering Perl/Tk (Stephen O. Lidie and Nancy Walsh, O'Reilly, 2002) or Sriram Srinivasan's Advanced Perl Programming (O'Reilly 1997).
Each chapter in Web, Graphics & Perl/Tk is a relatively separate essay focusing on a certain theme, so the book is suitable for browsing. You can read from the title page to the colophon, randomly choose any chapter as your starting point, or easily pick up from where you last left off. And because each part begins with a brief overview by Orwant, the book has a sense of continuity.
This book doesn't contain rudimentary knowledge such as Perl syntax and regular APIs. Its intention appears to be to integrate diverse topics to identify and clear up some technical mysteries. Its writing style is technical, not narrative. So, it's absolutely not a primer for beginners, although they'll likely understand a few chapters. Intermediate and advanced readers will get the most out of this book, and it's an excellent resource for Perl techniques. Anyone who's read another Perl book will profit from reading it.
Hippopotamus, dromedary, panther, ostrich, tarsier, lizard, boll weevil—when you pick up an O'Reilly book, you'll often see unusual animals such as these. Web, Graphics & Perl/Tk is no exception; this volume features an emu. The book is comprehensive, distinctive, and full of various Perl techniques. I recommend it to everyone who aims to become a Perl expert or who really likes the emu engraved on the cover. Perhaps it will become your all-time favorite Perl resource.
Haoyang Che is a PhD student at the Chinese Academy of Sciences' Institute of Software. Contact him at email@example.com.