Intermediate Perl

  Author:    Randal L. Schwartz, Tom Phoenix, Randal Schwartz, brian foy, brian d foy, Randal L Schwartz, Brian D. Foy
  ISBN:    0596102062
  Sales Rank:    31424
  Published:    2006-03-01
  Publisher:    O'Reilly Media, Inc.
  # Pages:    272
  Binding:    Paperback
  Avg. Rating:    5.0 based on 9 reviews
  Used Offers:    7 from $22.28
  Amazon Price:    $26.39
  (Data above last updated:  2008-08-29 05:04:44 EST)
  
  
Sort customer reviews by:
  
Show All Reviews on Page      Hide All Reviews on Page
   
  
Intermediate Perl
  

Perl is a versatile, powerful programming language used in a variety of disciplines, ranging from system administration to web programming to database manipulation. One slogan of Perl is that it makes easy things easy and hard things possible. Intermediate Perl is about making the leap from the easy things to the hard ones.

Originally released in 2003 as Learning Perl Objects, References, and Modules and revised and updated for Perl 5.8, this book offers a gentle but thorough introduction to intermediate programming in Perl. Written by the authors of the best-selling Learning Perl, it picks up where that book left off. Topics include:

  • Packages and namespaces
  • References and scoping
  • Manipulating complex data structures
  • Object-oriented programming
  • Writing and using modules
  • Testing Perl code
  • Contributing to CPAN

Following the successful format of Learning Perl, we designed each chapter in the book to be small enough to be read in just an hour or two, ending with a series of exercises to help you practice what you've learned. To use the book, you just need to be familiar with the material in Learning Perl and have ambition to go further.

Perl is a different language to different people. It is a quick scripting tool for some, and a fully-featured object-oriented language for others. It is used for everything from performing quick global replacements on text files, to crunching huge, complex sets of scientific data that take weeks to process. Perl is what you make of it. But regardless of what you use Perl for, this book helps you do it more effectively, efficiently, and elegantly.

Intermediate Perl is about learning to use Perl as a programming language, and not just a scripting language. This is the book that turns the Perl dabbler into the Perl programmer.

                  Reader Reviews 1 - 12 of 12                 
  
  
Review
Date
Review
Rating(5 High)
Review
Helpful
to:
Customer Review Reviewer
Info
Permanent
Link
Reader Reviews Below Sorted by Newest First
10-23-07 4 0\2
(Hide Review...)  Intermediate Perl has good code, good examples
Reviewer Permalink
This book has good perl examples and good perl code. It is a good choice if you have an intermediate understanding of the perl language.
(Review Data Last Updated: 2008-08-27 05:06:29 EST)
10-09-07 5 (NA)
(Hide Review...)  A worthy (as expected) successor
Reviewer Permalink
Successors are not always as expected. In this case you do get from this trio of authors, who are classics in their own right, just what you expect. In my own case, I needed to get good at OO Perl and fast. In three days, I covered the major chapters thoroughly, went off to my interview and in the end was told, "hey, you really know your stuff". This book intends and does indeed follow well the Learning Perl classic. If you finished the meat of the classic, this is the dessert. You'll recognize the writing style and flavour. There are no surprises. In my opinion, another classic.
(Review Data Last Updated: 2007-10-24 11:32:16 EST)
07-14-07 4 1\2
(Hide Review...)  Good follow up to the The Llama, but poorly organised
Reviewer Permalink
If you've mastered The Llama, make haste to read this one. Even if you only want to do scripting with Perl, you'll eventually find you need data structures slightly more complicated than just flat arrays and hashes, and you need to know about references for that. While The Camel does contain a fair chunk of material on just this subject, it was a bit too much for me to digest after The Llama. If Intermediate Perl (aka The Alpaca) had been around for me to read, I would have had a much easier time.

Written in the same style as The Llama, this breeze through most of the rest of Perl, in particular: references, objects, packages and modules. These are the bits that you need to use Perl as a general purpose programming language, not just for scripting. In a similar pragmatic vein, it also covers how to use tools to build your own packages in the CPAN style, and there's a good chunk of material on using Test::More for unit tests. Probably the only thing missing is material on type globs and symbol tables, although hopefully, brian d foy's forthcoming Mastering Perl will fill in these gaps.

The bottom line is this is Llama part 2, and you need to read it if you want to have any hope of understanding anyone else's Perl. But I can't give it five stars. The major problem is that the material is not very well organised. At the chapter level, objects are sandwiched between modules and packages. It would have been far preferable to keep the module and package information together. As a result, the distinction between modules and packages is rather muddied, and the introduction of objects in the middle just makes things worse. Overall, I found the explanations to lack the clarity of the Llama.

A more minor complaint is that, while there are mercifully fewer annoying footnotes, the Gilligan's Island theme (if, like me, you had no exposure to this growing up, you might want to read the Wikipedia article first!) grates far sooner than the Flintstones flavour of the Llama.

That said, make this your second book on Perl. Then, _still_ don't read The Camel yet. Avail yourself of Perl Best Practices first.
(Review Data Last Updated: 2007-10-10 02:30:26 EST)
02-20-07 5 5\5
(Hide Review...)  Good Book For Classroom Setting
Reviewer Permalink
I picked up this book for a class that I was teaching at my office. The goal of the class was to train HTML/CSS/JavaScript and/or Java programmers to code in Perl since a large portion of our code base is written in Perl. Overall, I think that the book was a good choice for the class for a number of reasons.

First of all, the book is already written with a classroom setting in mind. The authors have used previous versions of the book, titled "Learning Perl Objects, References and Modules", for their own courses. This updated version benefits from all of the hours of empirical testing that it has received in the classroom. There are many thoughtful additions like having all of the chapters close to the same size. This allowed for me to assign a single chapter per session and know that I could comfortably fit the lecture and discussion of the chapter into a two-hour session. There are also exercises at the end of each chapter and answers for those exercises (with discussion) in an appendix.

This book is good for getting people just learning the language ready for the TMTOWTDI/TIMTOWTDI aspect of Perl. Take something simple like opening files... there are at least four 'standard' ways to do it. The book prepares you for all of the different versions of annoyances/features like this that show up in Perl code by walking through the evolution of the feature.

Another reason that I like this selection of book is that data files and code examples are actually available for download. I've been shocked that some of the programming books that I've gotten lately actually don't have this addition.

Finally, the course that I'm teaching is for people who probably already know how to program, at least a little, but they don't know Perl. I didn't want to drag them through all of the picky details of the language by starting with "Learning Perl" or something equivalent. This book has been a good choice for introducing programmers to Perl. I do have to stop occasionally and explain some fundamentals of the language, but not too often... maybe I just work with smart (or shy) people :)

Of course, the book isn't perfect. As odd as it seems, one of the biggest complaints that I get is over the Gilligan references that are used in all of the examples in the book. There is also some coverage of packaging modules for CPAN. This is useful, just not for the particular class that I'm teaching, so we skipped that chapter. Of course, both of these complaints are pretty weak.

In short, this is a good book, especially if you are doing a training session about Perl.
(Review Data Last Updated: 2007-07-14 22:22:08 EST)
02-15-07 4 1\4
(Hide Review...)  Good, but not great
Reviewer Permalink
I didn't like the storyline, but I did learn how to handle anonymous arrays better.
(Review Data Last Updated: 2007-07-04 16:51:35 EST)
01-27-07 5 5\6
(Hide Review...)  Good sequel to Learning Perl
Reviewer Permalink
The first edition of this book was "Learning Perl Objects, References, and Modules". I never read that previous edition, so I can't comment on how that book stacks up against this new edition. This book is intended to pick up where Learning Perl left off. Its purpose is to show you how to use Perl to write larger more complex programs. As in Learning Perl, each chapter is small enough to read in an hour or so. Each chapter ends with a series of exercises to help you practice what you've just learned, and the answers are in the appendix for your reference. You don't have to know Unix to benefit from this book. Most everything in this book applies equally well to Windows ActivePerl from ActiveState and all other modern implementations of Perl. To use this book effectively, you just need to be familiar with the material in Learning Perl and have the ambition to go further. You should read this book from beginning to end, stopping to do the exercises as you go along. The following is the structure of the book:

Chapter 1, Introduction, just goes over what you should already know and how to use the book.

Chapter 2, Intermediate Foundations, introduces some intermediate-level Perl idioms used throughout the book. These are the things that typically set apart the beginning and intermediate Perl programmers.

Chapter 3, Using Modules, is about the building blocks for Perl programs. They provide reusable subroutines, variables, and even object-oriented classes. It also looks at the basics of using modules that others have already written.

Chapter 4 introduces references, which are the basis for complex data structures, object-oriented programming (OOP), and fancy subroutine magic. They're the magic that was added between Perl version 4 and version 5 to make it all possible. A Perl scalar variable holds a single value. An array holds an ordered list of one or more scalars. A hash holds a collection of scalars as values, keyed by other scalars. Although a scalar can be an arbitrary string, which allows complex data to be encoded into an array or hash, none of the three data types are well suited to complex data interrelationships. This is a job for the reference, which enables a level of redirection that allows the same code to operate on different sets of data.

Chapter 5, References and Scoping shows how to copy and pass around references like any other scalar. At any given time, Perl knows the number of references to a particular data item. Perl can also create references to anonymous data structures and create references automatically as needed to fulfill certain kinds of operations. This chapter look at copying references and how it affects scoping and memory usage.

Chapter 6, Manipulating Complex Data Structures, starts by using the debugger to examine complex data structures and then uses Data::Dumper to show the data under programmatic control. Next, you learn to store and retrieve complex data easily and quickly using Storable, and finally you wrap up with a review of grep and map and see how they apply to complex data.

Chapter 7, Subroutine References shows how to capture behavior as an anonymous subroutine that you create dynamically and execute later. In the same way that taking a reference to an array lets you have the same code work on different arrays at different times, taking a reference to a subroutine allows the same code to call different subroutines at different times. Also, references permit complex data structures. A reference to a subroutine allows a subroutine to effectively become part of that complex data structure

Chapter 8, Filehandle References, stores filehandles in scalar variables that you can easily pass around your program or store in data structures. You've seen arrays, hashes, and subroutines passed around in references, permitting a level of indirection to solve certain types of problems. We can also store filehandles in references to create new solutions to old problems.

Chapter 9, Practical Reference Tricks,looks at optimizing sorting and dealing with recursively defined data.

Chapter 10, Building Larger Programs, looks at how to break up a program into pieces and includes some of the concerns that arise when you put those pieces back together again, or when many people work together on the same program. You learn to build larger programs by separating code into separate files and namespaces.

Chapter 11, Introduction to Objects, shows how to work with classes, method calls, inheritance, and overriding.

Chapter 12, Objects with Data, shows how to add per-instance data, including constructors, getters, and setters.

Chapter 13, Object Destruction looks at an important topic: what happens when objects go away. When the last reference to a Perl data structure goes away, Perl automatically reclaims the memory of that data structure, including destroying any links to other data. Of course, that in turn may cause Perl to destroy other ("contained") structures as well.

Chapter 14, Some Advanced Object Topics, answers the questions "Do all objects inherit from a common class?" "What if a method is missing?" "What about multiple inheritance?" or "How can I tell what sort of object I have?" and other advanced questions pertaining to objects.

Chapter 15, Exporter, shows how to decide what to export and how to create your own import routines. In Chapter 3, you learned how to use modules, some of which pulled functions into the current namespace. Now you learn how to get your own modules to do that.

Chapter 16, Writing a Distribution, shows how to package a module for sharing, including portable installation instructions. In the previous chapter, you created a fictional Island::Plotting::Maps module and built the right support for Exporter so that we could include use Island::Plotting::Maps in a program. While the resulting .pm file was useful, it wasn't very practical. There is more work to do before you can share your work, whether that means simply installing it yourselves on another machine or giving it to someone else to use.

Chapter 17, Essential Testing, covers testing your code to ensure it does what you want it to do. As briefly described in Chapter 16, a distribution contains a testing facility that you can invoke from make test. This allows you to write and run tests during development and maintenance, and it also lets your end user verify that the module works in their environment. You should look at "Perl Testing: A Developer's Notebook" for in-depth coverage.

Chapter 18, Advanced Testing, gives you a taste of some of the more popular test modules. These modules are usually not part of the Perl standard distribution (unlike Test::More) and you'll need to install them yourself. You'll learn how to test complex aspects of code and also meta-code subjects such as documentation and test coverage.

Chapter 19, Contributing to CPAN, shows how you can contribute to the Perl community at large. The mechanism for sharing your work is called the Comprehensive Perl Archive Network (CPAN), which has thousands of different modules.

I found this book to be a seamless continuation of "Learning Perl". Everything is explained very well and there are plenty of examples. It really is ideal for self study. Having the answers at the back of the book was helpful, too. There are not just a bunch of pieces of code as answers, but good explanations as to how and why you would take a particular path in solving an exercise. Highly recommended, especially to the self-taught.
(Review Data Last Updated: 2007-07-04 16:51:35 EST)
01-26-07 5 2\2
(Hide Review...)  Good sequel to Learning Perl
Reviewer Permalink
The first edition of this book was "Learning Perl Objects, References, and Modules". I never read that previous edition, so I can't comment on how that book stacks up against this new edition. This book is intended to pick up where Learning Perl left off. Its purpose is to show you how to use Perl to write larger more complex programs. As in Learning Perl, each chapter is small enough to read in an hour or so. Each chapter ends with a series of exercises to help you practice what you've just learned, and the answers are in the appendix for your reference. You don't have to know Unix to benefit from this book. Most everything in this book applies equally well to Windows ActivePerl from ActiveState and all other modern implementations of Perl. To use this book effectively, you just need to be familiar with the material in Learning Perl and have the ambition to go further. You should read this book from beginning to end, stopping to do the exercises as you go along. The following is the structure of the book:

Chapter 1, Introduction, just goes over what you should already know and how to use the book.

Chapter 2, Intermediate Foundations, introduces some intermediate-level Perl idioms used throughout the book. These are the things that typically set apart the beginning and intermediate Perl programmers.

Chapter 3, Using Modules, is about the building blocks for Perl programs. They provide reusable subroutines, variables, and even object-oriented classes. It also looks at the basics of using modules that others have already written.

Chapter 4 introduces references, which are the basis for complex data structures, object-oriented programming (OOP), and fancy subroutine magic. They're the magic that was added between Perl version 4 and version 5 to make it all possible. A Perl scalar variable holds a single value. An array holds an ordered list of one or more scalars. A hash holds a collection of scalars as values, keyed by other scalars. Although a scalar can be an arbitrary string, which allows complex data to be encoded into an array or hash, none of the three data types are well suited to complex data interrelationships. This is a job for the reference, which enables a level of redirection that allows the same code to operate on different sets of data.

Chapter 5, References and Scoping shows how to copy and pass around references like any other scalar. At any given time, Perl knows the number of references to a particular data item. Perl can also create references to anonymous data structures and create references automatically as needed to fulfill certain kinds of operations. This chapter look at copying references and how it affects scoping and memory usage.

Chapter 6, Manipulating Complex Data Structures, starts by using the debugger to examine complex data structures and then uses Data::Dumper to show the data under programmatic control. Next, you learn to store and retrieve complex data easily and quickly using Storable, and finally you wrap up with a review of grep and map and see how they apply to complex data.

Chapter 7, Subroutine References shows how to capture behavior as an anonymous subroutine that you create dynamically and execute later. In the same way that taking a reference to an array lets you have the same code work on different arrays at different times, taking a reference to a subroutine allows the same code to call different subroutines at different times. Also, references permit complex data structures. A reference to a subroutine allows a subroutine to effectively become part of that complex data structure

Chapter 8, Filehandle References, stores filehandles in scalar variables that you can easily pass around your program or store in data structures. You've seen arrays, hashes, and subroutines passed around in references, permitting a level of indirection to solve certain types of problems. We can also store filehandles in references to create new solutions to old problems.

Chapter 9, Practical Reference Tricks,looks at optimizing sorting and dealing with recursively defined data.

Chapter 10, Building Larger Programs, looks at how to break up a program into pieces and includes some of the concerns that arise when you put those pieces back together again, or when many people work together on the same program. You learn to build larger programs by separating code into separate files and namespaces.

Chapter 11, Introduction to Objects, shows how to work with classes, method calls, inheritance, and overriding.

Chapter 12, Objects with Data, shows how to add per-instance data, including constructors, getters, and setters.

Chapter 13, Object Destruction looks at an important topic: what happens when objects go away. When the last reference to a Perl data structure goes away, Perl automatically reclaims the memory of that data structure, including destroying any links to other data. Of course, that in turn may cause Perl to destroy other ("contained") structures as well.

Chapter 14, Some Advanced Object Topics, answers the questions "Do all objects inherit from a common class?" "What if a method is missing?" "What about multiple inheritance?" or "How can I tell what sort of object I have?" and other advanced questions pertaining to objects.

Chapter 15, Exporter, shows how to decide what to export and how to create your own import routines. In Chapter 3, you learned how to use modules, some of which pulled functions into the current namespace. Now you learn how to get your own modules to do that.

Chapter 16, Writing a Distribution, shows how to package a module for sharing, including portable installation instructions. In the previous chapter, you created a fictional Island::Plotting::Maps module and built the right support for Exporter so that we could include use Island::Plotting::Maps in a program. While the resulting .pm file was useful, it wasn't very practical. There is more work to do before you can share your work, whether that means simply installing it yourselves on another machine or giving it to someone else to use.

Chapter 17, Essential Testing, covers testing your code to ensure it does what you want it to do. As briefly described in Chapter 16, a distribution contains a testing facility that you can invoke from make test. This allows you to write and run tests during development and maintenance, and it also lets your end user verify that the module works in their environment. You should look at "Perl Testing: A Developer's Notebook" for in-depth coverage.

Chapter 18, Advanced Testing, gives you a taste of some of the more popular test modules. These modules are usually not part of the Perl standard distribution (unlike Test::More) and you'll need to install them yourself. You'll learn how to test complex aspects of code and also meta-code subjects such as documentation and test coverage.

Chapter 19, Contributing to CPAN, shows how you can contribute to the Perl community at large. The mechanism for sharing your work is called the Comprehensive Perl Archive Network (CPAN), which has thousands of different modules.

I found this book to be a seamless continuation of "Learning Perl". Everything is explained very well and there are plenty of examples. It really is ideal for self study. Having the answers at the back of the book was helpful, too. There are not just a bunch of pieces of code as answers, but good explanations as to how and why you would take a particular path in solving an exercise. Highly recommended, especially to the self-taught.
(Review Data Last Updated: 2007-02-15 19:05:24 EST)
07-20-06 5 4\7
(Hide Review...)  Good step up for Perl programmers
Reviewer Permalink
For Perl programmers looking to make more of the language than just scripting this is the ideal 'step up' book. Object Oriented features of Perl are covered well. Writing and publishing CPAN modules is also covered, as are unit testing concepts.

If you want to expand your Perl world view this is an ideal second book to go along with the classic Programming Perl.
(Review Data Last Updated: 2007-07-04 16:51:35 EST)
07-19-06 5 2\4
(Hide Review...)  Good step up for Perl programmers
Reviewer Permalink
For Perl programmers looking to make more of the language than just scripting this is the ideal 'step up' book. Object Oriented features of Perl are covered well. Writing and publishing CPAN modules is also covered, as are unit testing concepts.

If you want to expand your Perl world view this is an ideal second book to go along with the classic Programming Perl.
(Review Data Last Updated: 2007-01-26 15:48:27 EST)
06-12-06 4 6\9
(Hide Review...)  Not As Good As Learning Perl
Reviewer Permalink
'Learning Perl' by the same authors is one of my favorite books of all time in in the O'Reilly family of books. It's incredibly well written, easy to follow, and it's like having the best instructor you could want teaching you live and in person. As for 'Intermediate Perl', this book is supposed to take regular Perl developers beyond the scripting abilities of the language, allowing them control of much of the power of any other popular and powerful programming language in the development world. While this book has lots of nice material, I find the book to not be as clear, concise, and easy to follow as the precursor to this book. I am certainly no Perl expert, so maybe that is part of the problem, but upon opening this book I had hoped to find a book that was easier to read for any and all programmers.

All in all, a nice book, but not up to snuff with what I had hoped for.

**** RECOMMENDED
(Review Data Last Updated: 2007-07-04 16:51:35 EST)
04-04-06 4 43\46
(Hide Review...)  Three years later, Sailors upgrade Perl navigation software
Reviewer Permalink
This book updates the 2003 "Perl References, Objects & Modules" from the same authors, which described (in a humorous but also realistic way) a group of "Sailors" writing navigation software.

First, I summarize the major changes of the new version:
1) The description of the methodology to partition software has been extended, leading to 3 separate chapters (3, 10, 15). I must say that it is not very clear why they are scattered in that order. I personally concluded that they are best read sequentially and in this order: first Chapter 10, "Building Larger Programs" (where the Sailors start reusing software first via 'cut and paste', then come to sanity via eval/do/require and finally 'package'); then Chapter 2, "Using Modules" (the natural follow up to 'package'); finally Chapter 15, "Exporter". Read in this order, they are a comprehensive and excellent overview of this subject. In the order presented in the book, they are odd (why would the sailors, after learning to use Modules in chapter 3, start 'cut and paste' and 'eval files' to reuse software in chapter 10?).
2) A new chapter "Intermediate Foundations", with a good section reminding the differences between 'eval string' versus 'eval {block }'.
3) The Testing area is enhanced with a new chapter "Advanced Testing". Information on CPAN & distributions is updated in several chapters. Also, while the examples in the book are largely the same, code style is improved; for example, the chapter on grep/map uses the 'grep { filter } array' and 'map { transform } array' style, rather than the less clear ', Expr' style of the first edition.
In all, a better book (aside from the absurd chapter organization choice remarked above).

For the ones who have not read the 1st edition, the strongs points of the rest of the book are:
a) the chapters 5, 6 on Data Structure manipulations. The best is the way that anonymous arrays & hashes are presented, showing how they simplify the code of an example (as their introduction removes a jungle of temporary variables). Autovivification follows, with another excellent example (a "data reduction report generator").
b) chapter 7 "Subroutine References", identical to the first edition, one of the best chapters, introducing anonymous subroutines by continously refining an example, and then doing the same for "Closures". The only regret is that the final example on closures is a bit dull (as the "findFile" runs always to the end in one shot), obscuring the central capability of closures to keep each its context simultaneously (imagine an example that computes different Dna strands alternating between them, or, to stay with the book's theme, moves different boats from their initial position...). Still, for people (like me) coming from static languages, the chapter was an authentic gift.
c) chapter 9 "Reference Tricks", with a great presentation of sorting, the famous Schwartzian Transform, and the processing of recursively defined data.
d) finally, the chapters on Objects, and the Class Hierarchy. Remark the simple and effective presentation of Inheritance, used to factor out code common to some classes (without indulging in any of the mystical overtones that often accompany this OO subject).

The points where the book is less perfect:
-) Although the book wants to stop at the "Intermediate level", it could at least indicate to the reader subjects to be developed; for example, closures and mod_perl (problems with Cgi under 'registry'), need of caution with unwanted autovivifications (when testing for existence), etc. Role of lexicals vs local should also be better explained.
-) Chapter 4, on References, attacks the subject of (de)referencing nested data structures. The central problem (known to strike terror in Perl tests and interviews): why do we need to write @{ $x[0] } to retrieve the array referenced by the first element of array @x? Rather than ingenious rules on "when braces are needed" and "when they can be lifted", I think it would be best to tell the facts:

"Gentlemen: the dark secret here is that the sigils $, @, % bind more tightly than the [], {} and -> subscripts. This forces us to place braces around $x[0] in the previous example and write @{ $x[0] }. If instead we wrote @$x[0], Perl would try to retrieve a slice (element 0) of the array referenced by scalar $x (that was not our case). Got that? now, lets' be brave: what if we have a reference $ref to a list of lists and we want one of the far lists?
In this case, we must write @{ $ref->[$i] } to allow $ref to work undisturbed on the first list, and (only then!) collect the far list. To get a slice of the far list (say, elements $m and $n), just append [$m, $n] to the expression just written. If you have hashes instead of arrays, replace [] with {}, and all the rest is identical. END OF STORY".
Yes, the previous paragraph is not a cute fairy tale, and it requires some experimenting to be interiorized. But, once you do, isn't this inmensely simpler (6 lines!) to remember? Fairy tales are sweet but do not make you strong!

-) Also: why teach first ${$item}[1] and only later introduce the arrow notation $item->[1]? Invert the order: use the arrow notation (universally intuitive) to develop the examples, mentioning briefly (for masochists and obfuscators) the other notation.

In conclusion: in spite of its shortcomings and defects, this is a very useful book to progress in Perl, as its "progressive refining method" forces you to a constant mental gymnastic to reach every formulation (the opposite of the "cut and paste" culture).
One last note: after reading the chapters on Objects, it is interesting to plunge into D.Conway's "Perl Best Practices" (see my review), chapter 15 "Objects", to examine a different object implementation ("the inside-out objects"). Aside from the fascinating thesis exposed there, the fact that one can easily acquire 2 different perspectives on how to construct (internally) Objects in Perl, shows perhaps that this book allows the reader to begin moving beyond the "intermediate level".
(Review Data Last Updated: 2007-07-04 16:51:35 EST)
04-04-06 4 17\20
(Hide Review...)  Three years later, Sailors upgrade Perl navigation software
Reviewer Permalink
This book updates the 2003 "Perl References, Objects & Modules" from the same authors, which described (in a humorous but also realistic way) a group of "Sailors" writing navigation software.

First, I summarize the major changes of the new version:
1) The description of the methodology to partition software has been extended, leading to 3 separate chapters (3, 10, 15). I must say that it is not very clear why they are scattered in that order. I personally concluded that they are best read sequentially and in this order: first Chapter 10, "Building Larger Programs" (where the Sailors start reusing software first via 'cut and paste', then come to sanity via eval/do/require and finally 'package'); then Chapter 2, "Using Modules" (the natural follow up to 'package'); finally Chapter 15, "Exporter". Read in this order, they are a comprehensive and excellent overview of this subject. In the order presented in the book, they are odd (why would the sailors, after learning to use Modules in chapter 3, start 'cut and paste' and 'eval files' to reuse software in chapter 10?).
2) A new chapter "Intermediate Foundations", with a good section reminding the differences between 'eval string' versus 'eval {block }'.
3) The Testing area is enhanced with a new chapter "Advanced Testing". Information on CPAN & distributions is updated in several chapters. Also, while the examples in the book are largely the same, code style is improved; for example, the chapter on grep/map uses the 'grep { filter } array' and 'map { transform } array' style, rather than the less clear ', Expr' style of the first edition.
In all, a better book (aside from the absurd chapter organization choice remarked above).

For the ones who have not read the 1st edition, the strongs points of the rest of the book are:
a) the chapters 5, 6 on Data Structure manipulations. The best is the way that anonymous arrays & hashes are presented, showing how they simplify the code of an example (as their introduction removes a jungle of temporary variables). Autovivification follows, with another excellent example (a "data reduction report generator").
b) chapter 7 "Subroutine References", identical to the first edition, one of the best chapters, introducing anonymous subroutines by continously refining an example, and then doing the same for "Closures". The only regret is that the final example on closures is a bit dull (as the "findFile" runs always to the end in one shot), obscuring the central capability of closures to keep each its context simultaneously (imagine an example that computes different Dna strands alternating between them, or, to stay with the book's theme, moves different boats from their initial position...). Still, for people (like me) coming from static languages, the chapter was an authentic gift.
c) chapter 9 "Reference Tricks", with a great presentation of sorting, the famous Schwartzian Transform, and the processing of recursively defined data.
d) finally, the chapters on Objects, and the Class Hierarchy. Remark the simple and effective presentation of Inheritance, used to factor out code common to some classes (without indulging in any of the mystical overtones that often accompany this OO subject).

The points where the book is less perfect:
-) Although the book wants to stop at the "Intermediate level", it could at least indicate to the reader subjects to be developed; for example, closures and mod_perl (problems with Cgi under 'registry'), need of caution with unwanted autovivifications (when testing for existence), etc. Role of lexicals vs local should also be better explained.
-) Chapter 4, on References, attacks the subject of (de)referencing nested data structures. The central problem (known to strike terror in Perl tests and interviews): why do we need to write @{$x[0]} to retrieve the array referenced by the first element of array @x?
Rather than ingenious rules on "when braces are needed" and "when they can be lifted", I think it would be best to say: "gentlemen, the dark secret here is that the sigils $,@,% bind more tightly than the [], {} and -> subscripts. This forces us to place braces around $x[0] in the previous example and write @{$x[0]}. If instead we wrote @$x[0], Perl would try to retrieve a slice (element 0) of the array referenced by scalar $x (that is not what you wanted, I assume, in this case). And, if we have a reference $ref to a list of lists, we must write @{$ref->[i]} to let the reference do its work in peace into the first list, and (only then!) collect the far list. End of story". Isn't this simpler to remember?
Also: why teach first ${$item}[1] and only later introduce the arrow notation $item->[1]? Invert the order: use the arrow notation (universally intuitive) to develop the examples, mentioning briefly (for masochists and obfuscators) the other notation.

In conclusion: in spite of its shortcomings and defects, this is a very useful book to progress in Perl, as its "progressive refining method" forces you to a constant mental gymnastic to reach every formulation (the opposite of the "cut and paste" culture).
One last note: after reading the chapters on Objects, it is interesting to plunge into D.Conway's "Perl Best Practices" (see my review), chapter 15 "Objects", to examine a different object implementation ("the inside-out objects"). Aside from the fascinating thesis exposed there, the fact that one can easily acquire 2 different perspectives on how to construct (internally) Objects in Perl, shows perhaps that this book allows the reader to begin moving beyond the "intermediate level".
(Review Data Last Updated: 2006-07-02 13:24:15 EST)
  
                  Reader Reviews 1 - 12 of 12                 
  
  
  
  
  
  

Because the data used to generate this site come from outside sources, VeryWellSaid.com cannot guarantee the completeness or accuracy of the data.
Search VeryWellSaid™
Google
Web VeryWellSaid™
New subjects are added every week.
View Subjects Below by:
* Top Selling
 (click category name, left)
* Top-Rated Top Sellers
 (click 'Top Rated', right)
In the news...  
Dubai\UAE Top Rated
Influenza\Bird Flu Top Rated
Iraq Top Rated
Supreme Court Top Rated
All Books Top Rated
Arts Top Rated
Photography Top Rated
Digital Photography Top Rated
Digital Cameras Top Rated
Biography Top Rated
Business Top Rated
Management Top Rated
Marketing Top Rated
Sales Top Rated
Stocks Top Rated
Bonds Top Rated
Real Estate Top Rated
Trading Top Rated
Commodities Trading Top Rated
Time Management Top Rated
Starting A Business Top Rated
Children's Top Rated
Comics Top Rated
Computers Top Rated
PC Top Rated
Mac Top Rated
Programming Top Rated
Design Patterns Top Rated
.Net Top Rated
C# Top Rated
Vb.Net Top Rated
Asp.Net Top Rated
Java Top Rated
Python Top Rated
PHP Top Rated
Perl Top Rated
Javascript Top Rated
Ajax Top Rated
CSS Top Rated
Open Source Top Rated
SQL Top Rated
Databases Top Rated
Oracle Top Rated
MySql Top Rated
Sql Server Top Rated
IIS Top Rated
Apache Top Rated
Linux Top Rated
Windows Server Top Rated
Project Management Top Rated
HTML Top Rated
UML Top Rated
IT Certifications Top Rated
Cisco Certifications Top Rated
MCSE Top Rated
MCSD Top Rated
Cooking Top Rated
Italian Cooking Top Rated
Vegetarian Cooking Top Rated
Wine Top Rated
Engineering Top Rated
Entertainment Top Rated
Health Top Rated
Nutrition Top Rated
Dieting Top Rated
Sex Top Rated
History Top Rated
Military History Top Rated
British History Top Rated
Middle East History Top Rated
Land Battles Top Rated
Naval Warfare Top Rated
Air Warfare Top Rated
9/11 Top Rated
Terrorism Top Rated
Home Top Rated
Mortgage\Home Equity Loan Top Rated
Cars Top Rated
Car Buying Top Rated
Sports Cars Top Rated
Cat Top Rated
Humor Top Rated
Horror Top Rated
Law Top Rated
IP Law Top Rated
Legal History Top Rated
Fiction Top Rated
Oprah's Book Club Top Rated
Medicine Top Rated
Cancer Top Rated
Stroke Top Rated
Heart Disease Top Rated
Fertility Top Rated
Diabetes Top Rated
Pharmacology Top Rated
Back Problems Top Rated
Menopause Top Rated
Thyroid Top Rated
Pain Top Rated
Organic Chemistry Top Rated
Immune System Top Rated
Mystery Top Rated
Nonfiction Top Rated
Outdoors Top Rated
Running Top Rated
Radio Control Models Top Rated
Guns Top Rated
Parenting Top Rated
Divorce Top Rated
Professional Top Rated
Reference Top Rated
Religion Top Rated
Romance Top Rated
Science Top Rated
Physics Top Rated
Chemistry Top Rated
Astronomy Top Rated
Psychology Top Rated
Science Fiction Top Rated
Sports Top Rated
Teens Top Rated
Travel Top Rated
USA Top Rated
Europe Top Rated
France Top Rated
Italy Top Rated
England Top Rated
China Top Rated
All Books Arts Biography Click Here For An A-Z Index Of All 213 Best-Seller Subjects Business Children's Comics
Computers Cooking Engineering Entertainment Health History Home Horror Humor Law Fiction Medicine Mystery
Nonfiction Outdoors Parenting Professional Reference Religion Romance Science Sci-Fi Sports Teens Travel
In Association with Amazon.com

Cache miss
(not cached)