Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Perl Books Media Programming Book Reviews IT Technology

Learning Perl Objects, References & Modules 158

honestpuck writes "In the world of Perl there was once only the 'camel book,' held in perhaps as much reverence as 'K & R' among C programmers. It certainly appealed to roughly the same audience, those who wanted a short, sharp introduction to a programming language. It was with a problem that needed solving and a copy of the camel book that I started as a Perl programmer." Read on for honestpuck's review of another book he regards at least as highly.
Learning Perl Objects, References & Modules
author Randal L. Schwartz with Tom Phoenix
pages 205
publisher O'Reilly
rating 9.9 - Cannot find a fault
reviewer Tony Williams
ISBN 0596004788
summary Perfect book for taking your Perl skills to the next level

Then for those that wanted a introduction to Perl and programming Randal L. Schwartz wrote Learning Perl, a book that has arguably become the definitive textbook for teaching Perl. The one weakness was that it left off before really getting to the guts of building large, complex projects in Perl. It did not cover classes, objects, breaking your code up into pieces or the more arcane aspects of variables, references. For this we had to resort to the last few chapters of the 'camel book' and I, for one, have never really been totally comfortable at this end of the language; when I'm reading someone else's code it might take a couple of reads to fully understand the process.

Now this weakness has been well and truly addressed. Schwartz, with Tom Phoenix, has written "Learning Perl Objects, References & Modules", a volume that takes the same steady approach to teaching you the more advanced topics as the earlier 'Learning Perl'. Schwartz has spent the years since writing 'Learning Perl' teaching and writing. You can tell, this is a superbly written book, not that 'Learning Perl' wasn't well written; it's just that this volume is far better.

The Guts

The book starts with a chapter on building larger programs that covers @INC, eval, do and require before discussing packages and scope. It then has several chapters on references that explains in well understandable fashion and increasing complexity all the ins and outs of references including dereferencing, nested references, references to subroutines and references to anonymous data before a final chapter on references that gives you some incredibly useful tricks such as sorting and recursively defining complex data.

The book continues with three chapters that give you a solid grounding in Perl objects. Here Schwartz has assumed that you know at least a little about object oriented programming, some may feel the need for more explanation of concepts might be required, but if you've had any experience in OOP before then the clear examples and descriptions here are probably all you want.

Modules are not as well covered, with only a single chapter, but it is hard to think of anything left out, it covers using them and building your own so well that it left me wondering what all the fuss was about, "seems obvious to me." The book concludes with chapters on building a distribution out of your module, testing it using make test (with Test::Harness), Test::Simple and Test::More before a chapter telling you how to contribute to CPAN.

Each chapter of the book concludes with a number of small exercises, designed to be done in just a few minutes, that cement the learning of the previous chapter. The answers to these are at the end of the book.

Conclusion

Once I'd finished I felt I had a much more solid grounding in Perl, certainly I was much better able to understand another programmer's code that dealt with such things as subroutine references and some complex data structures. While the subject matter of this book is almost entirely covered in 'Programming Perl' the tutorial aspects of this book made it much easier going. The style would be familiar to anyone who has read 'Learning Perl', light without being frivolous and extremely well written, Schwartz seems a master at reducing complexity to manageable bites.

This book is deceptively easy to follow, each new idea built onto earlier ones, each new language concept introduced in an easy manner. The writing is excellent, it's hard to explain why I appreciated it so much. That may be the reason, the writing isn't forced or heavy or too light or obvious. It just allows the solid material of the book to shine through. Go to the ubiquitous O'Reilly website and grab the example chapter (the site also has a few Errata, the Table of Contents and the code from the book) and give it a look.

I think this may well become a classic, I may well in ten years time talk of Schwartz's books with the same awe I now talk of Brian Kernighan's. I'll certainly eagerly await his next book and keep this one close until it comes. Oh, and Randal, how about 'Software Tools for Perl Programmers'?


You can purchase Learning Perl Objects, References & Modules from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

This discussion has been archived. No new comments can be posted.

Learning Perl Objects, References & Modules

Comments Filter:
  • by Anonymous Coward on Tuesday August 05, 2003 @01:21PM (#6616685)
  • I have it too (Score:5, Informative)

    by JanneM ( 7445 ) on Tuesday August 05, 2003 @01:31PM (#6616807) Homepage
    I recently bought this, and for much the same reasons as the reviewer.

    Basically, if your introduction to Perl was via "Learning Perl" then this is probably a great next step. I went through the Camel book and the Perl cookbook instead, and find that this one does not give all that much more information as I would have liked. This is not strange; the authors explicitly say in the preface that this is the companion book to "Learning Perl".

    On the upside, it does give a good deal of useful snippets of info, and it manages to give clear explanations for some stuff that is otherwise quite opaque; the way it explains the Perl object model, for example is much clearer to me than the treatment given in the Camel book.

    I would have given it 7.5-8 rather than the extreme score the reviewer gave.
  • by pileated ( 53605 ) on Tuesday August 05, 2003 @01:50PM (#6616988)
    How bout "has anyone started both books?" Based on that comparison I'd say I've gotten farther in this book than I ever did in Damian Conway's book (which I had really high expectations for based on reviews). In fact I think I started the Conway book more than once but never got more than 1/4 of the way through it. I'm halfway through this one now and have no doubts that I'll complete it.

    Of course then I might go back and reread the Conway just to see if it makes more sense.

    So for me I prefer this one. But that's just me. I liked the Conway book but it just got too dense too quick.

  • by afabbro ( 33948 ) on Tuesday August 05, 2003 @01:56PM (#6617045) Homepage
    I've read it cover to cover and use it frequently. Definitely the best perl book I've read (with the list of "perl books I've read" consisting of most of the O'Reilly line). Conway covers OOP theory, how to apply it in perl, neat perl-only tricks, and a lot of fun stuff. His examples are hilarious and his writing among the best traditions of technical instruction. Even OOP aside, I learned more about perl from Damian's book than anything else I've read. Highly recommended.
  • by Bluetrust25 ( 647829 ) on Tuesday August 05, 2003 @02:11PM (#6617226)
    Randal Schwartz is a regular over at PerlMonks.org. He's replied to a couple of my threads and helped me out of some sticky situations. It's rare for such a talented programmer to be so accessible and helpful to the public.

    He's written well over 3,000 posts on Perl [perlmonks.org] over at PerlMonks.org [perlmonks.org].
  • by TheMostBob ( 538122 ) on Tuesday August 05, 2003 @02:25PM (#6617519) Homepage
    Dragon*Con [dragoncon.com] this year, and probably local hacker cons PhreakNIC [phreaknic.info] and Interz0ne [interz0ne.com], if you want to meet him. He's a pretty happy drunk.

    Bob

  • Re:Half way through (Score:3, Informative)

    by jslag ( 21657 ) on Tuesday August 05, 2003 @02:46PM (#6617879)
    The way it makes you put different objects in different files/modules is so counter to Perl's scripting heritage

    Different classes can be defined in the same file, no problem - just make a package declaration to begin each new one.

    Having said that, I've never wanted to actually have more than one class in a file. Sure, OO is counter to 'Perl's scripting heritage', but so what? There's a reason that much of the good stuff on CPAN is written in an OO style.
  • by Christianfreak ( 100697 ) on Tuesday August 05, 2003 @03:07PM (#6618139) Homepage Journal
    Wouldn't that be the fault of the people who didn't bother to learn basic concepts like OO programming rather than the fault of the people who know how to use it?

    OO in Perl is not hard, sure its syntax is a bit different but the concepts are the same and there are multiple books (like this one), online resources such as this [perlmonks.org], and not to mention the existance of 4 (not 1 or 2 but 4) tutorials on OO in perl that come with the documentation. If people don't expect their "schmucks in the cube farm" to be skilled in a language then its no wonder that our jobs are going to India!
  • by Thomas A. Anderson ( 114614 ) on Tuesday August 05, 2003 @03:35PM (#6618471) Homepage
    I started Damiens book, and it was way to dense for me. I just picked up Randals book and started it last night. It truly starts where learning perl (and the coookbook) ends and I feel that I'll be much more successdful understanding this book (and hence, becoming an OO perl programmer).

    I'm not bagging on Damiens book at all - it just started above my head.

    As for the poeple baggin on Randals book, my guess is is started at too low a level for them, so they think its useless - completly forgetting that they are just 1 of many perl programmers - all at different levels of ability.
  • by merlyn ( 9918 ) on Tuesday August 05, 2003 @05:17PM (#6620015) Homepage Journal
    Damian's book is great, but a good comparison would be that Learning Perl is to the Camel what Learning Perl Objects, References and Modules is to Damian's book. Both of my tutorial books are tutorial in design, based on years of classroom experience in teaching these subjects. Both of the other books are reference in design.

    Also, the OO part of the Alpaca book is only a portion of the text, and is necessarily light in coverage. The point of the Alpaca is to get you to understand most 100 to 10,000 line programs in as few moves as possible, just as the Llama is to get you to understand most 1 to 100 line programs. The design demands that I try to hit only the 80/20 point, covering the 20% of the features that are used in 80% of the programs. For the rest, you'll need to go to the Camel, the perldocs, and Damian's book.

"Experience has proved that some people indeed know everything." -- Russell Baker

Working...