Wednesday, July 20, 2005

Three Approaches: Advanced Perl Programming by Simon Cozens

PANTHER

The second edition of Advanced Perl Programming, by Simon Cozens, is very different from the first edition, because it comes into a different world of Perl programming than the first, published in 1997, did. Cozens points out in the introduction the two reasons for this shift. The first was the development and introduction of Perl 6, which had the effect of stretching Perl 5, as thousands of Perl genies found ways to make the current version do things that were promised for Perl 6.

The second reason, though, was both more subtle and more powerful, a true paradigm shift. The focus of Perl programming had shifted "away from techniques and toward resources." Knowing where to find a tasty pearl of Perl and how to plug it into your own structure has become more important than knowing how to create it in the first place, because the resources are out there.

Camel button: Powered by Perl
     Camel = Perl

Because of the shift, Advanced Perl Programming concentrates on three crafty ways to use those resources. Cozens spells them out in Chapter 1, "Advanced Techniques":
I've said that there are no secret switches to turn on advanced features in Perl, and this means that everyone starts on a level playing field, in just the same way that Johan Sebastian Bach and a kid playing with a xylophone have precisely the same raw materials to work with... First, we'll look at introspection: programs looking at programs, figuring out how they work, and changing them... The second idea we'll look at is the class model... As this is an advanced book, we're going to learn how to subvert Perl's object-oriented model... Finally, there's the technique of what I call unexpected code—code that runs in places you might not expect it to... These three areas, together with the special case of Perl XS programming... delineate the fundamental techniques from which all advanced uses of Perl are made up.

Cozens has created a map for some fairly complex territory with these three classes of approach. The first chapter comprises a kind of legend for this map, detailing some "basic" applications of each class. For example, introspection is illustrated with glob aliasing, in which the pointer for a whole group of variables is "hijacked" (purposefully) to serve another glob. From there, he takes us swiftly through accessing glob elements ("to access the individual references, you can treat the glob itself as a very restricted hash..."), closures ("a code block that captures the environment where it's defined..."), AUTOLOAD, and "two of the most misunderstood pieces of Perl arcana," CORE and CORE::GLOBAL. By page 20, Cozens has pulled these six elements into service to show the power of introspection, and he's ready to introduce "messing with the model."

Exploration is always simpler when you have a map, but any explorer will tell you, a map is not sufficient in itself. To get the most from this book, you need to be fairly familiar with Perl, and it helps to have several other languages under your belt as well. Cozens occasionally intersperses Perl examples with code from Ruby and C, but the meat of his instruction comes in showing how even frequently-used Perl goodies have little-used "hooks" that allow them to be repurposed. So although "one of the draws of Ruby is that everything is an object," but "you can't do that in Perl, [because] 2 is not an object," by manipulating the model "we can fake it."

Once we are somewhat familiar with his three techniques, Cozens leads us further into dark territory. We look at advanced parsing techniques, for dealing with data that isn't presented in a regular, structured format. He covers both top-down and bottom-up parsing, using Perl tools that are already available from CPAN and other sources. Next, he takes us through templating tools (one of those "perfectly good wheels that every journeyman Perl programmer reinvents"), beginning with "format" and Text::Autoformat, then diving into HTML::Template (a Perl program that outputs HTML code) and HTML::Mason (HTML code that incorporates and runs snippets of Perl).

In Chapter 4, "Objects, Databases and Applications," the author addresses one of Perl's great strengths. Every advanced Perl user can appreciate the value of neat techniques for sorting and manipulating data. What Cozens has done, though, is to move beyond the ordinary here, showing us how to put existing tools and applications together in vital new ways. This is a chapter full of little "trap" icons, too—the icons indicate pitfalls of Perl programs, with valuable guidance that will help you avoid the trap.

The next chapter covers Perl's abilities to process natural languages, so the computer can "understand" them. The author uses a real-world issue—identifying spam—to illustrate how Perl can do this. Then he covers Perl and Unicode, and the Perl Object Environment, and a section on testing that advanced code you've written.

The final chapters detail how inline extensions let Perl programs run snippets of other executable code, and how you can play with with the stuff you've learned. In using inline extensions, it helps to have that other programming language under your belt—Cozens uses C, Python, Ruby and CPR. The toy-filled final chapter has poetry playthings and even golf. My favorite, though, is "bleach," a module that does nothing much—but so cleverly, it's fun to trace its activity through the code!

Advanced Perl Programming is Safari-enabled, which means its contents are searchable online, if you have a subscription. But if you're an intermediate Perl user, wanting to move up a notch, what you really want is a copy of this manual at your desk, and hours to spend working through the examples. It's definitely worth the time.
0596004567,0596101058,0596100922,0596001738,0596000278,1565926994,1565924193


Please join us at BlogCritics to comment on this review.

7 Comments:

Anonymous Anonymous said...

thats a very good review. I found some free perl books online which might be useful to your readers.

http://vaandoo.blogspot.com/2006/08/top-4-perl-books-for-free-download.html

8/29/2006 11:45 PM  
Anonymous Anonymous said...

oops. sorry guys. looks like the URL is not enabled. Here you go:
Top 4 Perl Books for free download.

8/29/2006 11:47 PM  
Blogger shahidsidd said...

Nice and knowledgeable sites for everyone-
booksshelf
knowledge
books
liberary
kitaben
Books and references
books
tutorial books

9/07/2007 9:50 PM  
Anonymous zantac said...

companies marketing mineral makeups and also get the best bargains in mineral makeup you can imagine,
find aout how to consolidate your students loans or just how to lower your actual rates.,
looking for breast enlargements? in Rochester,
homeopathy for eczema learn about it.,
Allergies, information about lipitor,
save big with great bargains in mineral makeup,

change edition interviewing motivational people preparing second
,

interviewing motivational people preparing second time
,

interviewing people motivational preparing for a second time
,

black mold exposure
,

black mold exposure symptoms
,

black mold symptoms of exposure
,

free job interview questions
,

free job interview answers
,

interview answers to get a job
,

lookfor hair styles for fine thin hair
,

search hair styles for fine thin hair
,

hair styles for fine thin hair
,

beach resort in the philippines
,

great beach resort in the philippines
,

luxury beach resort in the philippines
,
iron garden gates, here,
iron garden gates,
wrought iron garden gates
, here
,
wrought iron garden gates
,
You: The Owner's Manual: An Insider's Guide to the Body That Will Make You Healthier and Younger
,
eat eating mindless more than think we we why
,


texturizer,
texturizers here,
black hair texturizer,
find aout how care curly hair,
find about how to care curly hair,
care curly hair,
lipitor rash,
lipitor reactions,
new house ventura california,
the house new houston tx,
new house washington dc,
new house pa philadelphia,
san antonio tx house new,
house new pa philadelphia,
new house washington dc,
new house ventura california,
the house new houston tx,
house new san antonio tx,
the house new houston tx, that you are looking for,
new house ventura california, you need to buy,
new house washington dc,
house new pa philadelphia,
new house san antonio tx,

hair surgery transplant
,

air filter allergy
,

refurbished dell laptop computers
,

hair surgery transplant
,

air filter allergy
,

refurbished dell laptop computers
,

hair surgery transplant
,

air filter allergy
,

refurbished dell laptop computers
,

chocolate esophagus heartburn study
,

chocolate esophagus heartburn study
be informed,

digestion healing healthy heartburn natural preventing way
,

digestion healing healthy heartburn natural preventing way
,
sew skirts, 16simple styles you can make!,
sew what skirts 16 simple styles you,
rebates and discounts on sunsetter awnings,
sunsetter awnings discounts and rebates,
discount on sunsetter awnings


truck and bus tires 12r 22.5, get the best price,
tires truck and bus 12r 22.5 best price,
tires truck bus tires12r 22.5 best price,
plush car seat strap covers,
car seat strap covers,plush,
car seat strap, plush covers,
oscoda voip phone systems, the best!,
oscoda voip the phone system,
oscoda voip phone systems,
exterior iron gates,
oriental wrought iron gates,
powder coated iron garden fencing,

2/14/2008 2:18 PM  
Anonymous fero 52 said...

black mold exposure,
black mold symptoms of exposure,

wrought iron garden gates,
your next iron garden gates, here,

hair styles for fine thin hair,
search hair styles for fine thin hair,

night vision binoculars,
buy, night vision binoculars,

lipitor reactions,
lipitor reactions,

luxury beach resort in the philippines,
beach resort in the philippines,

homeopathy for baby eczema.,
homeopathy for baby eczema.,

save big with great mineral makeup bargains,
companies marketing mineral makeups,

prodam iphone praha,
Apple prodam iphone praha,

iphone clone cect manual,
manual for iphone clone cect,

fero 52 binoculars night vision,
fero 52 night vision,

best night vision binoculars,
buy, best night vision binoculars,

computer programs to make photo albums,
computer programs, make photo albums,

3/24/2008 7:40 AM  
Anonymous Anonymous said...

No deposit bez depozytu senza depozito free non depositare poker bonus free
do odbioru bonusu trzeba się spieszyć bo znikna z powierzchi ziemi
aktualne bonusy poker online free
poker texas lub także internetowy muszę napisać więcej unikalnego tekstu tutaj , bo mi się nudzi graj bez depozytu
online poker za free - sponsor
platforma promocyjna będzie dziś w bonusie bez deponowanym graj w omaha hold'em lub titan poker
bez depozytu bonus free full tilt wtop czyli world tour of poker aktualne zastawienie bonusów
-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-POKER-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-
bankroll $50 - INTERNATIONAL players
To be eligible to withdraw this bonuses or bankroll and Your winning You will have to play a minimum amount of raked hands at the poker room.
free poker money - online poker page free start up money
poker sign up actual free money
Complete list of the best actual free poker cash poker bankroll without requirments online site & pages free start up money for us.
Please note that this tool is not a 90% accurate but $50 representation of search engine algorithms of wsop poker and should not be used
free bankroll no deposit required
free bankroll no deposit cash required and best sponsor
Play poker online for free :)

6/07/2009 7:25 AM  
Blogger samraat said...

sangambayard-c-m.com

4/03/2010 10:46 PM  

Post a Comment

<< Home