Learning Perl/Tk

by Bill Cunningham
  • Author: Nancy Walsh

  • Publisher: O'Reilly & Associates

  • E-mail: info@ora.com

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

  • Price: $32.95 US

  • ISBN: 1-56592-314-6

  • Reviewed by: Bill W. Cunningham

Learning Perl/Tk, by Nancy Walsh, is the first of what will undoubtedly be many books on this subject, and it will be a tough act to follow. This book is targeted for those just beginning windows programming in Perl/Tk on both UNIX and Windows platforms, although veteran programmers will find a wealth of detailed information in it as well.

Learning Perl/Tk is well-written and thoroughly researched. It begins with a brief history of the Perl and Tk languages. It tells exactly where to download the Perl/Tk module, how to unpack and install it, and how to test your installation to see if you are ready to write Perl/Tk programs.

Next is a general discourse on window geometry, and the concepts of the widget and the event loop. These are details the windows programmer must deal with that do not apply to the traditional Perl programmer. Ms. Walsh does a fine job of explaining these concepts in terms anyone can understand.

The majority of the book is devoted to a detailed description of the most commonly used window widgets: the button, check box, radio button, label, entry, scrollbar, list box, text box, canvas, scale, menu, frame and composite widgets such as the dialog box. Virtually every aspect pertaining to these widgets is covered in the minutest detail: color, placement, size, border size, style and functionality. Other widgets are available in Perl/Tk, but these are the most common ones, and in order not to get too far out in left field, the book limits its focus to these.

The author's code examples are written in an elegant, concise, easy-to-follow style. For example, the following code creates five text entry widgets, each in a different relief style, with the style's name displayed in the respective boxes:

foreach (qw/flat groove raised ridge sunken/) {
$e = $mw->Entry(-relief=> $_)->pack(-expand=> 1);
$e->insert('end', $_);

This example appears on page 112 of the book. Throughout, the author demonstrates an enviable command of the Perl language, particularly the object-oriented features.

The book does a great job of bringing the first-time Perl/Tk user up to speed. By the end of the second chapter, the reader will have at least five fully-functional windows programs up and running. And for the veteran programmer, the book goes into a level of detail about the various window widgets which should meet the most demanding needs.

There is something of a void of information for the intermediate-level programmer. For example, there is no discussion of how to create a text-entry widget, get some user input from the widget, and use Perl to do something useful with the input. The Perl/Tk module does come with many demo examples that basically fill this gap. I did notice a few minor typos in the book, but it was obvious even to me (a non-programmer) how to fix them. Almost all the code runs perfectly. I know, because I typed in and ran each example! Virtuous (i.e., lazy) programmers can download all the book's code from the O'Reilly web site (http://www.oreilly.com/catalog/lperltk/).

Learning Perl/Tk provides a simple yet thorough introduction to this newest method of writing windows programs, and will also be a valuable reference for the production programmer. There is room for more books on this subject at the intermediate level.

I believe anyone with an interest in Perl/Tk will benefit from reading this book, and I recommend it with enthusiasm.

Bill W. Cunningham, Gunnery Sergeant in the U.S. Marine Corps, is a system administrator with the Second Marine Aircraft Wing, G-7, Cherry Point, NC (the greatest job in the universe). He likes playing guitar, reading, driving and spending as much time as possible with his wife and four kids. He can be reached at bwc@coastalnet.com.
Load Disqus comments