Learning Perl Objects, References & Modules
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.
Man I can't read my own perl, I can't imagine buying a book simply for the pleasure of reading someone else's
"Sanity is not statistical", George Orwell, "1984"
... for those of us who can never remember the titles, only the critters.
Slashdot's token middle-aged housewife
$3.50 cheaper at amazon (extra 10% off = 33% cheaper)
Rating: 9.9 - Cannot find a fault
Obviously, the review was calculated using an early Pentium.
It was with a problem that needed solving and a copy of the camel book that I started as a Perl programmer
how else would one want to learn perl?
!(^((ri)|(mp))aa$)
how about putting a spoiler warning! you practically gave away the ending!
You did the author a huge disservice.
I cant disagree with the reviewer more. This book is crammed with anecdotes and stories, and very little actual information.
Which while some may enjoy cute little stories about the time the guy was up all night to meet a deadline, some of us read technical books to learn or enhance technical skills.
This is so far from K&R it's sacrelige to even make the comparison. Shame on you.
I don't need no instructions to know how to rock!!!!
That book is essentially worthless except for looking up random facts after you've been programming C for a few months. In contrast, the camel book is useful even for long-time Perl hackers, because Perl has more built into the language (e.g., regexps, hashes, etc.) than C, the latter of which is incredibly simple by comparison.
[Aside: The book I use most often is Stroustrup's C++ Second Edition, which in itself is rather vague and outdated wrt the details I need to know most often these days. I'm thinking of getting myself a copy of one of the C++ specs to help me answer the really obscure questions. Does someone recommend a particular spec (e.g., ANSI, ISO)?]
[ home ]
Perl: The Complete Reference is a very good and easy to read and understand perl book. Its somewhat old but still a great book.
At some point you have to put the books down and start programming if you truly want to master the language. After the Camel book is probably a good time to start, with references to the Cookbook when needed. For other info, the perldocs are recommended.
Has anyone read both this book and Damien Conway's book? I'd be interested in a comparison. I like the Conway book, but it's a little dense for me. Or I'm too dense for it... either way...
If it is so ubiquitous, why embed a link to it?
Rating: 9.9 - Cannot find a fault. Uhm. Now please tell me - why not 10 then?
Dietel and Dietel is good.
C++ How to Program.
Some people need books, others don't. Personally I find the ActivePerl documentation to be excellent.
The idea that you can do a PPM search for a module via CPAN based on your need, download it, and have it's docs integrated into the centralized documentation is great. perlfunc, perlre, perlobj, etc are a bit arcane but with a little elbow grease and a good editor (SlickEdit!), you figure things out pretty quick.
# Erik
Finally! *NOT* reading the article pays off!
Wait for the movie.
I heard O'Reilly got Tom Cruise to be in it.
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.
Trust the Computer. The Computer is your friend.
I agree!
Once you've read the camel book, you are truly "over the hump", and can really start to program in Perl.
Don't buy it. It's a cheap Chinese knock-off of Deitel and Deitel, whom I wholeheartedly recommend.
Perl died in the 90's when PHP was introduced... if you code perl, then get w/it and code PHP
Why would they move to a less capable language?
(and I'm not even a Perl guy)
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.
In other words, Perl needs a book devoted to topics that are totally straightforward in a well-designed language.
I couldn't disagree more. I learned C from the original K&R book. It was well organized, clear, and consise. The Camel book, on the other hand, often seemed like concepts on page n relied on concepts introduced on page n+1. I found that no matter how much I programmed in Perl (about a year's worth of time) and no matter how much I used the Camel book, I could never find what I was looking for without a massive search.
Actually, this pretty much solved all my obscure or arcane C++ questions. In fact, while referring to that I haven't once had trouble figuring out if I was implicitly causing a conversion which caused a deep copy which in turn caused a memory leak since.
Of course, "Why did my program just pause for a 1/10th of a second, and how can I avoid that?" comes up more often now.
She was pretty fat, you mean
and it's slow going, but I've sure learned a lot. Now maybe I'm dense but I don't think that references, anonymous hashes, references, subroutines are all that easily understood. In fact you can accomplish a whole hell of a lot in Perl without understanding them. But for anyone wanting to make the jump to larger more complex programs you really need to understand them. I'm just finishing the references section (first half) and still have the objects section ahead of me. I've read the tutorial on objects before and at first glance this book looks similar to it. But I didn't get as far in the tutorial as I would have liked, I think because I didn't understand references as well as I should. With the solid foundation that this book gives I think that I'll get a whole lot more out of the objects section, even if it more or less duplicates the tutorial (which I doubt).
So, half way through, I give it two thumbs up. My Perl programming has just gotten a lot more sophisticated. Maybe I was dense to begin with but any step up is something I'm happy about.
As far as those nutty complaints about O'Reilly lingering at the bottom of this thread all I can say is that they've found their proper place.
List Price: $34.95
Our Price: $21.50
You Save: $13.45 (38% Off)
It took me a second to get the joke, but your point is well taken. I have taken great pains to implement garbage collection in C++, but significant understanding of the language is still required to avoid certain pessimal behaviors, which is especially problematic when others use my garbage collector. :)
[ home ]
How does honestpuck have teh time to review so many terse technical books? I wonder if these reviews are as well thought out as they could be if honestpuck was not trying to crank out 3 a week. I am going to propose the conspiracty theory that honestpuck is really an alias for a group of 10 Slash developers!
BTW, I should point out that my garbage collector is better behaved than Java's: I don't have to refer to any documentation to know when the memory is going to be cleaned up, and I don't have huge 1/10-second delays caused by such events, because the behavior of the garbage collector is well-defined, even across compilers, since it's done at language-level, not at bytecode/machine code level.
:( That is enough to keep me away from it unless I absolutely have to use it.
Also, I can't believe Java still doesn't have templates. For shame.
squarooticus
Just pretty.
At least it has a clear structure (and don't complain about the indentng issue; use an editor that does the indenting for you) and proper commands.
Perl looks like modem line noise and it expects you to know regular expressions which are just about as intuitive and easy to remember as emacs commands.
Trinity dies at the end of Gigli.
a failure is always a failure
When was you sex change?
And just why was this moderated as redundant?
Yes. It's a troll, maybe a flamebait, but redundant?! Fucking moron moderators.
And if you think this will be corrected by the metamoderation, think again. Slashdot moderation is utterily broken.
Next time, post a ninja-link to goatse.cx -- at least some guy's bloody asshole is less disgusting that watching b-flack and j-lo trying to act!
Do you even lift?
These aren't the 'roids you're looking for.
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 over at PerlMonks.org.
Because it has lots of k3wl functions. Wow, system, passthru, shell_exec and bactics? So many choices of how I can execute my perl scripts!!
It's turkey time. Gobble, gobble.
slashdot really needs a score -1 punny moderation.
I totally agree. There is *nothing* in the language that forces people to write bad code with Perl (and frankly there are plenty of unreadable non-Perl projects out there).
On the POPFile project I've done everything I can to avoid Perl's temptations into obscurity by writing clear code. Amazingly I've been critized by monoric readers of the code that I could have done things with less "space" (i.e. using less screen real estate). People like that know nothing about maintenance of code and should just bug off.
If you come across Perl code that's unreadable don't blame the language, blame the author. People who write obfuscated code in any language are doing a disservice to themselves and others who read the code; if they release the code as open source then it's a _crime_ since they are inviting readers to work on their crud.
John.
This is why I laughed at the original post -- if the Camel book is a "short, sharp introduction," I'd hate to see the reviewer's idea of a sprawling book.
To be fair, a sprawling language like Perl needs a sprawling reference, and the Camel book does a decent job of it.
Personally, I don't often refer to K&R, but that's because C is a simple language that you can learn in its entirety without too much effort. Who truly knows all of Perl? Or C++ or COBOL, to mention two other giant languages? A small percentage of the users of all three. Which is not a criticism of Perl per se -- I use C and Perl and enjoy both -- but comparing C with Perl is like comparing apples and, uhm, county-fair-prize-winning giant pumpkins.
Proud member of the Weirdo-American community.
Bob
-- Bob
In Soviet Russia there's more than one way to do you.
K&R's book is entirely appropriate, when used for its intended purpose. I came to C from Perl and found K&R's book ideal. It was, after all, designed to be an introduction to C for someone who was already a quite competent programmer. I'll agree that, apart from an occasional reference, its usefulness drops quickly; after the first read-through it is largely useless. However, and importantly, I tried three other books on C first, and only K&R's was helpful. Most of the rest were either obsessed with teaching advanced C techniques, or introducing programming concepts with which I have long been familiar. The book is effective in what it does.
Are you insane? That book is utter crap.
I think not.
Can't imagine curling up with this one
MMORPG Fan? Prove your worth!
why are you jealous of the whore trying to get commissions from people?
... because very few perl scripters know how to do it... write an OOP script in Perl, and only an expert will be able to maintain your work.
This is so common in Perl (and other languages). Especially with contractors, for some reason. They come in, write expert level code, using all the secret codes and handshakes, then the average schmucks in the cube farms cannot maintain the code.
Mod down people who tell people how to mod in their sigs
Jeez... all he did was point out another book, OK it's about Ruby not Perl, however, the common theme is object orientation. Isn't it true that a lot of Perl-folk could gain by taking a look into Ruby if they're interested in OO programming?
Almost every perl programmer will spout on and on about how great the Camel book is when in fact, as technical books go, it sucks. Witty, eccentric examples don't make a great book. The fact is no one wants to admit that the book sucks because they will be thought of as a fool. So they proudly trumpet from the mountain tops that nothing is better than the camel book all the while hoping no one notices that they don't understand a bit of it.
So, I will play the part of the small child in the story of "The Emperor's New Clothes" and say, "Hey wait a minute, the camel book sucks! It's about time someone else took a crack at this!"
--Jazztunes
This shouldn't be confusing. How about foo[ bar ][ foo2 ]? Indexing into a 2-dimensional array in C. Your example is the same except that we index associative arrays.
Great book and a must-have if you enjoyed "Learning Perl" and would like to round out your knowledge of the language. Daimon Conway's "Object-Oriented Perl" is also a great book and would follow nicely from Randal's if your objective is to write good OO code in Perl.
Even though I already have Conway's book I still picked up Schwartz's since I need a quick refresher and Schwartz has a knack for being clear, concise and congenial for the real-world programmer.
Definitely consider picking it up if your working on a moderately complex project that would benefit from better code organization and maintainability. Using references, modules and objects is essential in such situations.
in other languages in order to see the difference?
I can think of at least 2 languages that are
50 miles simpler to read.
But syntax is not a major issue anyway. The
main issue is the capabilities of the language.
Apparently, those who speak on issues of syntax
and general look-and-feel have no knowledge
to talk about the more techincal issues. So here
here you have it: 1000 posts about how the
language "feels", and we are going to skip
the hard technical issues which you have
not heard about, much less know them!
No wonder non-techincal issues like SCO vs. IBM
receive record posts. Same reason here with syntax style.
It certainly appealed to roughly the same audience, those who wanted a short, sharp introduction to a programming language.
I like the Camel Book, but short it ain't. The Third Edition is 1067 pages. For that much paper you can have K&R2 and Advanced Programming in the UNIX Environment, or the ISO C spec and a pretty complete POSIX reference, or almost half of the GCC manpage.
As the intro says, the K & R books are the bees knees when comes to introducing C to programmers.
Can anybody provide a link?
Try;
1 31 103628/qid=1060164149/sr=8-2/ref=sr_8_2/104-927662 1-2139163?v=glance&s=books&n=507846
http://www.amazon.com/exec/obidos/tg/detail/-/0
C Programming Language (2nd Edition)
:)
by Brian W. Kernighan, Dennis Ritchie, Dennis M. Ritchie
For some reason the link doesnt work
I think you've missed the point if you try to do object oriented in Perl. If you want to do objects, use a language that was invented with objects in mind such as C# or Java.
People should not fear their government. Governments should fear their people.
I got this book a few weeks back. This is really a nice book. It does not have a high page count, but still contains a lot of information. Ofcourse this book is not for everybody.
Are you using perl now? You know it well enough to get most of your things done fairly quickly and easily. Typicly you don't write large perl scripts but sure would like to and would like know more perl. then buy this book, it will tell you most of the stuff you're missing.
Some people here argue that all the information is in perldoc etc. but this book is never the less nice, if only for the exercises after each chapter.
On a long enough timeline, the survival rate for everyone drops to zero.