PERL - How to Programby jepri (Parson)
|on Nov 15, 2001 at 08:13 UTC||Need Help??|
Item Description: A very complete perl book
Is there somebody here by the name of Deitel? Because PERL How to Program by Deitel looks a lot like it was written by a perl monk. This 1029 page book (personally I would have cut 5 pages out, no matter how difficult) covers all the issues that have been hot topics over the last year, as well as providing a good introduction into programming, and perl programming.
Don't be put off by the size or the attempt to be comprehensive. Each chapter is stands on it's own, starting with an explanation of why the chapter is there, and then moves into the juicy bits. And juicy they are. The author covers core perl functionality and CGI, DBI and LWP. Whole chapters take detours into file and directory manipulation, using formats, sessions and cookies, process management, web security, Tk, accessibility, XML, CSS and HTML. Phew. There's more, but you should read the table of contents for the full list.
The highlight of the book is that it demonstrates good programming practice. Modules and the strict pragma are introduced in chapter 6, and from that point on every example program uses strict;. Every program also uses warnings, indicating that the authors are as up-to-date as we would hope them to be. And (can ya believe it?) the book has a section on taint checking. It's a good one too, describing how to clean tainted variables with regular expressions.
One of the things that differentiates the book is its little asides, which are broken down into Common Programming Errors, Performance Tip, Portability Tips, Testing and Debugging Tips, Good Programming Practice and Software Engineering Observations. I’ve probably left a few out as well. These asides are usually only a sentence long, but contain the wisdom that is often deeply buried in the perl man pages. The Common Programming Errors are definitely the jewels in the book – they offer very relevant and useful tips like: "Forgetting to return a true value from a module will cause a fatal compile time error" (in the section on writing modules). I know I've seen at least two Seekers of Perl Wisdom questions about exactly that.
Lest you think that the book is too simple, I should point out that the chapters on arrays and data structures go into binary searches and binary trees using hashes, while the networking section shows how to send and receive mail, and a code example showing how to write your own chat servent. The XML section covers what you would want – VoiceXML and XSL and DTDs and DOMs and lions and tigers and bears – oh my! The network section has examples of sending and receiving mail (using modules).
The code! I almost forgot to mention the book has many chunks of code examples, all well commented, with example output from the programs. The programs are then dissected to show what they do.
But wait! There's more! Each chapter has a summary and mini-index, a list of www resources and a list of references where applicable. The CDROM that comes with the book has a copy of Perl 5.6 and ActiveState’s Perl 5.6, MYSQL, Apache, and all the code from the book in convenient-to-run files. The last chapter of the book, strangely, is an introduction to Python programming.
It feels kind of strange to write a review without mentioning any down points, but I'm having trouble finding them. If I really tried to find faults I might mention that the regex chapter is barely more than a search and replace tutorial, and sometimes the code reads more like C than Perl ( like the authors sometimes put ()s around print statements. E.g. print(arg1, arg2, arg3, arg4, ...) rather than print arg1, arg2, arg3, arg4, .... I suspect this is from a desire for clarity, since they show that they do know advanced perl idioms. There are no advanced techniques in the book, but you wouldn't expect that in a 'how to program book'.
Overall I am very impressed with this book. It covers many topics without being shallow, explains things simply without condescending and contains enough detail and references to make it useful to almost anyone. It is factually correct and does not omit or overlook important points. It encourages the use of CPAN, modules and good programming styles without degenerating into the religious fervour that is so common when dealing with those topics. If it was a bit cheaper I’d be giving away copies for christmas, but instead I’ll be keeping this one for myself.
Update - Frickin' internet explorer mangled the punctuation. Now cleaing it.