Perl 6 Essentials, Perl Cookbook, and Perl Template Toolkit
In this installment, Ted reviews three Perl coding books, bringing you summaries of the key information contained in the books and how the new versions have been updated.
The three books I'm reviewing in this installment are all from O'Reilly & Associates, but are quite different, as you will see. They are, however, all good guides to specific aspects of Perl programming that you will appreciate on your bookshelf.
I'd like to thank O'Reilly & Associates for kindly providing me copies of the books reviewed here.
Perl 6 Essentials
This book deals with the future. The future of Perl, that is. Perl 6 Essentials is a look ahead to the new Perl 6, and the authors promise yearly revisions to keep up with the rapid pace of Perl 6 development. The authors are heavily involved in Perl 6 development, and it shows. The book is at once an introduction to the Perl 6 culture, the Perl 6 language, and the Perl 6 internals. That it succeeds at all three levels in just under 200 pages is a testament to the skill of the authors.
The book opens with an overview of Perl 6, offering enough background information to bring new Perl programmers up to date on everything they need to know, and then fills this picture out with details on how Perl 6 development works, how to go about reviewing the latest versions, and even how to follow developer releases of Perl 6.
The authors then prepare the reader for Chapter 4's discussion of Perl 6 syntax, by covering Perl principles and rules.
Chapter 4 is where the meat starts. It's a very complete summary of what you can expect in Perl 6, and if I had to pick just one chapter out of the book, this is it. Every Perl programmer should read this chapter, not just to salivate over Perl 6 features, but also to say "Gee, I never thought of that" because Perl 6 often suggests new perspectives to Perl 5 developers. The only shortcoming of Chapter 4 is that it's not intended for beginners. The material is intensely entertaining and concise, and it assumes knowledge of Perl 5 terminology and background.
Having programmed with Emacs Lisp, which supports symbol-associated properties, I am excited about Perl 6 properties, which do something very similar. Properties are sure to add a whole new "sideways" dimension to Perl programming. I say "sideways" because they provide a way to express meanings "on the side," without complicating the program's logic, and without requiring an object-oriented approach. There are many other features I haven't the space to mention. I felt like a kid in a candy store reading about junctions, currying, and all the other exciting features that Perl 6 promises.
Chapter 4 explains the Perl 6 grammars in relatively great detail,
which I certainly appreciated. The Perl 6 grammars are the one feature
that is sure to confuse, vex, and inspire programmers. They are
light-years beyond Perl 5 grammars; in fact, they are more like the
Parse::RecDescent grammars in their flexibility. If you want to
understand Perl 6 grammars, you'll have to learn more about lexing and
parsing that you probably ever wanted to.
After the fulfilling fourth chapter, Chapter 5 delves into the Parrot internals. Parrot is the engine that runs Perl 6 code, and therefore is very important for Perl 6 programming. The authors explain and defend all their design choices for Perl 6. The Parrot internals are definitely not for programming beginners. Familiarity with computer architecture, compiler internals, and even other languages such as the Java? language helps you digest the material. To me, Chapter 5 was fascinating, but my opinion may be biased by my own experience. If you are the sort of programmer that gets excited about multimethod dispatching and iterator implementations, this chapter is for you. If you aren't, you may want to give Chapter 5 and the rest of the book only a light read this time around, and re-read the material at a later time, or again in a later version of the book (which promises to be updated in a year).
Chapter 6 answers the age-old question "Enough with the talk, can we see something happen?" The Parrot assembly language is introduced. Like Chapter 5, Chapter 6 presumes knowledge of computer architecture, and at least some experience in programming assembly language. Without those, Chapter 6 may seem cryptic.
If Chapter 4 was the Perl 6 driving manual, Chapter 6 is the engine parts list. Most of the features shown in Chapter 4 are not in Chapter 6, but the means to achieve them are. After reading this chapter, I understood the syntax and features of Perl 6 much better than before. For example, the explanation of stacks and register frames in Chapter 6 connected with Chapter 4's explanation of variable scope.
In addition, Chapter 6 has some instructions on how to get the engine parts into a whole new car, meaning that the choice of language is not exclusively Perl 6. I found it interesting to imagine how Java code or Lisp code could be expressed in Parrot assembly, in a crazy-computer-science-professor sort of way.
After all the fun of Chapter 6, Chapter 7 describes how IMCC, the Intermediate Code Compiler, can simplify much of the work involved in programming in Parrot assembly. IMCC makes life easier, but it does not take away the burden of understanding how Parrot works internally. IMCC is still a tough interface to the Parrot features.
Chapters 5 through 7 are definitely not light reading, but they are very rewarding. I hope to see more of those topics in the next edition of the Perl 6 Essentials book.
Overall, Perl 6 Essentials was a good book. I would recommend that beginner programmers wait until a more accessible book about Perl 6 becomes available, as this one condenses years of Computer Science and Engineering courses into 200 pages. For intermediate and advanced Perl programmers, Perl 6 Essentials is a must-have roadmap to the future of Perl.