Tải bản đầy đủ

OReilly intermediate perl mar 2006 ISBN 0596102062

IntermediatePerl
Bybriandfoy,TomPhoenix,RandalL.Schwartz
...............................................
Publisher:O'Reilly
PubDate:March2006
PrintISBN-10:0-596-10206-2
PrintISBN-13:978-0-59-610206-7
Pages:278

TableofContents|Index

Perlisaversatile,powerfulprogramminglanguageusedinavarietyofdisciplines,ranging
fromsystemadministrationtowebprogrammingtodatabasemanipulation.Onesloganof
Perlisthatitmakeseasythingseasyandhardthingspossible.IntermediatePerlisabout
makingtheleapfromtheeasythingstothehardones.

Originallyreleasedin2003asLearningPerlObjects,References,andModulesandrevised
andupdatedforPerl5.8,thisbookoffersagentlebutthoroughintroductionto
intermediateprogramminginPerl.Writtenbytheauthorsofthebest-sellingLearningPerl,
itpicksupwherethatbookleftoff.Topicsinclude:


Packagesandnamespaces
Referencesandscoping
Manipulatingcomplexdatastructures
Object-orientedprogramming
Writingandusingmodules
TestingPerlcode
ContributingtoCPAN


FollowingthesuccessfulformatofLearningPerl,wedesignedeachchapterinthebookto
besmallenoughtobereadinjustanhourortwo,endingwithaseriesofexercisestohelp
youpracticewhatyou'velearned.Tousethebook,youjustneedtobefamiliarwiththe
materialinLearningPerlandhaveambitiontogofurther.

Perlisadifferentlanguagetodifferentpeople.Itisaquickscriptingtoolforsome,anda
fully-featuredobject-orientedlanguageforothers.Itisusedforeverythingfrom
performingquickglobalreplacementsontextfiles,tocrunchinghuge,complexsetsof
scientificdatathattakeweekstoprocess.Perliswhatyoumakeofit.Butregardlessof
whatyouusePerlfor,thisbookhelpsyoudoitmoreeffectively,efficiently,andelegantly.

IntermediatePerlisaboutlearningtousePerlasaprogramminglanguage,andnotjusta
scriptinglanguage.ThisisthebookthatturnsthePerldabblerintothePerlprogrammer.


IntermediatePerl
Bybriandfoy,TomPhoenix,RandalL.Schwartz
...............................................
Publisher:O'Reilly
PubDate:March2006
PrintISBN-10:0-596-10206-2
PrintISBN-13:978-0-59-610206-7
Pages:278

TableofContents|Index













































IntermediatePerl
Foreword
Preface
StructureofThisBook
ConventionsUsedinThisBook
UsingCodeExamples
CommentsandQuestions
Safari®Enabled
Acknowledgments
Chapter1.Introduction
Section1.1.WhatShouldYouKnowAlready?
Section1.2.WhatAboutAllThoseFootnotes?
Section1.3.What'swiththeExercises?
Section1.4.WhatIfI'maPerlCourseInstructor?
Chapter2.IntermediateFoundations
Section2.1.ListOperators
Section2.2.TrappingErrorswitheval
Section2.3.DynamicCodewitheval
Section2.4.Exercises
Chapter3.UsingModules
Section3.1.TheStandardDistribution
Section3.2.UsingModules
Section3.3.FunctionalInterfaces
Section3.4.SelectingWhattoImport














































































Section3.5.Object-OrientedInterfaces
Section3.6.AMoreTypicalObject-OrientedModule:Math::BigInt
Section3.7.TheComprehensivePerlArchiveNetwork
Section3.8.InstallingModulesfromCPAN
Section3.9.SettingthePathattheRightTime
Section3.10.Exercises
Chapter4.IntroductiontoReferences
Section4.1.PerformingtheSameTaskonManyArrays
Section4.2.TakingaReferencetoanArray
Section4.3.DereferencingtheArrayReference
Section4.4.GettingOurBracesOff
Section4.5.ModifyingtheArray
Section4.6.NestedDataStructures
Section4.7.SimplifyingNestedElementReferenceswithArrows
Section4.8.ReferencestoHashes
Section4.9.Exercises
Chapter5.ReferencesandScoping
Section5.1.MoreThanOneReferencetoData
Section5.2.WhatIfThatWastheName?
Section5.3.ReferenceCountingandNestedDataStructures
Section5.4.WhenReferenceCountingGoesBad
Section5.5.CreatinganAnonymousArrayDirectly
Section5.6.CreatinganAnonymousHash
Section5.7.Autovivification
Section5.8.AutovivificationandHashes
Section5.9.Exercises
Chapter6.ManipulatingComplexDataStructures
Section6.1.UsingtheDebuggertoViewComplexData
Section6.2.ViewingComplexDatawithData::Dumper
Section6.3.YAML
Section6.4.StoringComplexDatawithStorable
Section6.5.UsingthemapandgrepOperators
Section6.6.ApplyingaBitofIndirection
Section6.7.SelectingandAlteringComplexData
Section6.8.Exercises
Chapter7.SubroutineReferences
Section7.1.ReferencingaNamedSubroutine
Section7.2.AnonymousSubroutines
Section7.3.Callbacks














































































Section7.4.Closures
Section7.5.ReturningaSubroutinefromaSubroutine
Section7.6.ClosureVariablesasInputs
Section7.7.ClosureVariablesasStaticLocalVariables
Section7.8.Exercise
Chapter8.FilehandleReferences
Section8.1.TheOldWay
Section8.2.TheImprovedWay
Section8.3.TheEvenBetterWay
Section8.4.IO::Handle
Section8.5.DirectoryHandleReferences
Section8.6.Exercises
Chapter9.PracticalReferenceTricks
Section9.1.ReviewofSorting
Section9.2.SortingwithIndices
Section9.3.SortingEfficiently
Section9.4.TheSchwartzianTransform
Section9.5.Multi-LevelSortwiththeSchwartzianTransform
Section9.6.RecursivelyDefinedData
Section9.7.BuildingRecursivelyDefinedData
Section9.8.DisplayingRecursivelyDefinedData
Section9.9.Exercises
Chapter10.BuildingLargerPrograms
Section10.1.TheCurefortheCommonCode
Section10.2.InsertingCodewitheval
Section10.3.Usingdo
Section10.4.Usingrequire
Section10.5.requireand@INC
Section10.6.TheProblemofNamespaceCollisions
Section10.7.PackagesasNamespaceSeparators
Section10.8.ScopeofaPackageDirective
Section10.9.PackagesandLexicals
Section10.10.Exercises
Chapter11.IntroductiontoObjects
Section11.1.IfWeCouldTalktotheAnimals...
Section11.2.IntroducingtheMethodInvocationArrow
Section11.3.TheExtraParameterofMethodInvocation
Section11.4.CallingaSecondMethodtoSimplifyThings
Section11.5.AFewNotesAbout@ISA















































































Section11.6.OverridingtheMethods
Section11.7.StartingtheSearchfromaDifferentPlace
Section11.8.TheSUPERWayofDoingThings
Section11.9.WhattoDowith@_
Section11.10.WhereWeAreSoFar...
Section11.11.Exercises
Chapter12.ObjectswithData
Section12.1.AHorseIsaHorse,ofCourseofCourseorIsIt?
Section12.2.InvokinganInstanceMethod
Section12.3.AccessingtheInstanceData
Section12.4.HowtoBuildaHorse
Section12.5.InheritingtheConstructor
Section12.6.MakingaMethodWorkwithEitherClassesorInstances
Section12.7.AddingParameterstoaMethod
Section12.8.MoreInterestingInstances
Section12.9.AHorseofaDifferentColor
Section12.10.GettingOurDepositBack
Section12.11.Don'tLookInsidetheBox
Section12.12.FasterGettersandSetters
Section12.13.GettersThatDoubleasSetters
Section12.14.RestrictingaMethodtoClass-OnlyorInstance-Only
Section12.15.Exercise
Chapter13.ObjectDestruction
Section13.1.CleaningUpAfterYourself
Section13.2.NestedObjectDestruction
Section13.3.BeatingaDeadHorse
Section13.4.IndirectObjectNotation
Section13.5.AdditionalInstanceVariablesinSubclasses
Section13.6.UsingClassVariables
Section13.7.WeakeningtheArgument
Section13.8.Exercise
Chapter14.SomeAdvancedObjectTopics
Section14.1.UNIVERSALMethods
Section14.2.TestingOurObjectsforGoodBehavior
Section14.3.AUTOLOADasaLastResort
Section14.4.UsingAUTOLOADforAccessors
Section14.5.CreatingGettersandSettersMoreEasily
Section14.6.MultipleInheritance
Section14.7.Exercises










































Chapter15.Exporter




































Section15.1.WhatuseIsDoing
Section15.2.ImportingwithExporter
Section15.3.@EXPORTand@EXPORT_OK
Section15.4.%EXPORT_TAGS
Section15.5.ExportinginaPrimarilyOOModule
Section15.6.CustomImportRoutines
Section15.7.Exercises
Chapter16.WritingaDistribution
Section16.1.There'sMoreThanOneWayToDoIt
Section16.2.Usingh2xs
Section16.3.EmbeddedDocumentation
Section16.4.ControllingtheDistributionwithMakefile.PL
Section16.5.AlternateInstallationLocations(PREFIX=...)
Section16.6.Trivialmaketest
Section16.7.Trivialmakeinstall
Section16.8.Trivialmakedist
Section16.9.UsingtheAlternateLibraryLocation
Section16.10.Exercise
Chapter17.EssentialTesting
Section17.1.MoreTestsMeanBetterCode
Section17.2.ASimpleTestScript
Section17.3.TheArtofTesting
Section17.4.TheTestHarness
Section17.5.WritingTestswithTest::More
Section17.6.TestingObject-OrientedFeatures
Section17.7.ATestingTo-DoList
Section17.8.SkippingTests
Section17.9.MoreComplexTests(MultipleTestScripts)
Section17.10.Exercise
Chapter18.AdvancedTesting
Section18.1.TestingLargeStrings
Section18.2.TestingFiles
Section18.3.TestingSTDOUTorSTDERR
Section18.4.UsingMockObjects
Section18.5.TestingPOD
Section18.6.CoverageTesting
Section18.7.WritingYourOwnTest::*Modules
Section18.8.Exercises


Chapter19.ContributingtoCPAN




























































Section19.1.TheComprehensivePerlArchiveNetwork
Section19.2.GettingPrepared
Section19.3.PreparingYourDistribution
Section19.4.UploadingYourDistribution
Section19.5.AnnouncingtheModule
Section19.6.TestingonMultiplePlatforms
Section19.7.ConsiderWritinganArticleorGivingaTalk
Section19.8.Exercise
AppendixA.AnswerstoExercises
SectionA.1.AnswersforChapter2
SectionA.2.AnswersforChapter3
SectionA.3.AnswersforChapter4
SectionA.4.AnswersforChapter5
SectionA.5.AnswersforChapter6
SectionA.6.AnswerforChapter7
SectionA.7.AnswersforChapter8
SectionA.8.AnswersforChapter9
SectionA.9.AnswersforChapter10
SectionA.10.AnswersforChapter11
SectionA.11.AnswerforChapter12
SectionA.12.AnswerforChapter13
SectionA.13.AnswersforChapter14
SectionA.14.AnswersforChapter15
SectionA.15.AnswerforChapter16
SectionA.16.AnswerforChapter17
SectionA.17.AnswersforChapter18
SectionA.18.AnswerforChapter19
AbouttheAuthor
Colophon
Index


IntermediatePerl
byRandalL.Schwartz,briandfoy,andTomPhoenix
Copyright(c)2006,2003O'ReillyMedia,Inc.Allrights
reserved.
PrintedintheUnitedStatesofAmerica.
PublishedbyO'ReillyMedia,Inc.,1005GravensteinHighway
North,Sebastopol,CA95472.
O'Reillybooksmaybepurchasedforeducational,business,or
salespromotionaluse.Onlineeditionsarealsoavailablefor
mosttitles(safari.oreilly.com).Formoreinformation,contact
ourcorporate/institutionalsalesdepartment:(800)998-9938or
corporate@oreilly.com.
Editors:

AllisonRandalandTatianaApandi

ProductionEditor:

DarrenKelly

Copyeditor:

ChrisDowney

Proofreader:

NancyReinhardt

Indexer:

AngelaHoward

CoverDesigner:

KarenMontgomery

InteriorDesigner:

DavidFutato

Illustrators:

RobertRomano,JessamynRead,andLesleyBorash


PrintingHistory:
June2003:

FirstEdition,publishedasLearningPerlObjects,References&Modules.

March2006:

SecondEdition.

NutshellHandbook,theNutshellHandbooklogo,andthe
O'ReillylogoareregisteredtrademarksofO'ReillyMedia,Inc.
IntermediatePerl,theimageofanalpaca,andrelatedtrade
dressaretrademarksofO'ReillyMedia,Inc.
Manyofthedesignationsusedbymanufacturersandsellersto
distinguishtheirproductsareclaimedastrademarks.Where
thosedesignationsappearinthisbook,andO'ReillyMedia,Inc.
wasawareofatrademarkclaim,thedesignationshavebeen
printedincapsorinitialcaps.
Whileeveryprecautionhasbeentakeninthepreparationofthis
book,thepublisherandauthorsassumenoresponsibilityfor
errorsoromissions,orfordamagesresultingfromtheuseof
theinformationcontainedherein.
ISBN:0-596-10206-2
[M]




Foreword
Perl'sobject-oriented(OO)mechanismisclassic
prestidigitation.IttakesacollectionofPerl'sexistingnon-OO
features,suchaspackages,references,hashes,arrays,
subroutines,andmodules,andthenwithnothingupits
sleevemanagestoconjureupfullyfunctionalobjects,classes,
andmethods,seeminglyoutofnowhere.
That'sagreattrick.ItmeansyoucanbuildonyourexistingPerl
knowledgeandeaseyourwayintoOOPerldevelopment,
withoutfirstneedingtoconqueramountainofnewsyntaxor
navigateanoceanofnewtechniques.Italsomeansyoucan
progressivelyfine-tuneOOPerltomeetyourownneeds,by
selectingfromtheexistingconstructstheonethatbestsuits
yourtask.
Butthere'saproblem.SincePerlco-optspackages,references,
hashes,arrays,subroutines,andmodulesasthebasisforits
OOmechanism,touseOOPerlyoualreadyneedtounderstand
packages,references,hashes,arrays,subroutines,and
modules.
Andthere'stherub.Thelearningcurvehasn'tbeeneliminated;
it'smerelybeenpushedbackhalfadozensteps.
Sothen,howareyougoingtolearneverythingyouneedto
knowaboutnon-OOPerlsoyoucanstarttolearneverything
youneedtoknowaboutOOPerl?
Thisbookistheanswer.Inthefollowingpages,Randaldraws
ontwodecadesofusingPerl,andfourdecadesofwatching
Gilligan'sIslandandMr.Ed,toexplaineachofthecomponents
ofPerlthatcollectivelyunderpinitsOOfeatures.And,better
still,hethengoesontoshowexactlyhowtocombinethose
componentstocreateusefulclassesandobjects.


SoifyoustillfeellikeGilliganwhenitcomestoPerl'sobjects,
references,andmodules,thisbookisjustwhattheProfessor
ordered.
Andthat'sstraightfromthehorse'smouth.
DamianConway,May2003


Preface
Overadecadeago(nearlyeternityinInternetTime),Randal
SchwartzwrotethefirsteditionofLearningPerl.Inthe
interveningyears,Perlitselfhasgrownsubstantiallyfroma
"cool"scriptinglanguageusedprimarilybyUnixsystem
administratorstoarobustobject-orientedprogramming(OOP)
languagethatrunsonpracticallyeverycomputingplatform
knowntomankind.
Throughoutitsfoureditions,LearningPerlremainedthesame
size(about300pages)andcontinuedtocovermuchofthe
samematerialtoremaincompactandaccessibletothe
beginningprogrammer.Butthereismuchmoretolearnabout
Perlnowthanwhenthatfirstbookwaswritten.
RandalcalledthefirsteditionofthisbookLearningPerlObjects,
References,andModules,andnowit'sIntermediatePerl,but
weliketothinkofitasjustLearningMorePerl.[*]Thisisthe
bookthatpicksupwhereLearningPerlleavesoff.Weshowyou
howtousePerltowritelargerprograms.
[*]Don'taskwhyitisn'tcalledthat.Wemusthavehad300emailsonthesubject.Okay,ask,sinceweknow
you'regoingtoanyway.YouneverreallystoplearningPerl,soLearningMorePerldoesn'treallytellyoumuch
aboutthebook.Oureditorchosethename,whichtellsyouwhattoexpect.

AsinLearningPerl,wedesignedeachchaptertobesmall
enoughtoreadinjustanhourorso.Eachchapterendswitha
seriesofexercisestohelpyoupracticewhatyou'vejust
learned,andtheanswersareintheappendixforyour
reference.AndlikeLearningPerl,we'vedevelopedthematerial
inthisbookforateachingenvironmentanduseditinthat
setting,includingforourownuseatStonehengeConsulting
Services,asweconducton-siteandopen-enrollmenttrainings.
Youdon'thavetobeaUnixguru,orevenaUnixuser,tobenefit


fromthisbook.Unlessotherwisenoted,everythinginthisbook
appliesequallywelltoWindowsActivePerlfromActiveStateand
allothermodernimplementationsofPerl.Tousethisbook,you
justneedtobefamiliarwiththematerialinLearningPerland
havetheambitiontogofurther.




StructureofThisBook
Youshouldreadthisbookfromfronttoback,stoppingtodothe
exercises.Eachchapterbuildsonprecedingchapters,andwe'll
assumethatyouknowthematerialfromthosechaptersaswe
discussnewtopics.

Chapter1,Introduction
Anintroductiontothematerial.

Chapter2,IntermediateFoundations
PickupsomeintermediatePerlskillsyou'llneedfortherest
ofthebook.

Chapter3,UsingModules
UsePerl'scoremodules,aswellasmodulesfromother
people.We'regoingtoshowyouhowtocreateyourown
moduleslaterinthebook,butuntilwedo,youcanstilluse
modulesyoualreadyhave.

Chapter4,IntroductiontoReferences
Introducealevelofredirectiontoallowthesamecodeto
operateondifferentsetsofdata.


Chapter5,ReferencesandScoping
LearnhowPerlmanagestokeeptrackofpointerstodata,
andanintroductiontoanonymousdatastructuresand
autovivification.

Chapter6,ManipulatingComplexDataStructures
Create,access,andprintarbitrarilydeepandnesteddata
structures,includingarraysofarraysandhashesofhashes.

Chapter7,SubroutineReferences
Capturebehaviorasananonymoussubroutinethatyou
createdynamicallyandexecutelater.

Chapter8,FilehandleReferences
Storefilehandlesinscalarvariablesthatyoucaneasilypass
aroundyourprogramorstoreindatastructures.

Chapter9,PracticalReferenceTricks
Sortingcomplexoperations,theSchwartzianTransform,
andworkingwithrecursivelydefineddata.

Chapter10,BuildingLargerPrograms
Buildlargerprogramsbyseparatingcodeintoseparatefiles
andnamespaces.


Chapter11,IntroductiontoObjects
Workwithclasses,methodcalls,inheritance,and
overriding.

Chapter12,ObjectswithData
Addper-instancedata,includingconstructors,getters,and
setters.

Chapter13,ObjectDestruction
Addbehaviortoanobjectthatisgoingaway,including
objectpersistence.

Chapter14,SomeAdvancedObjectTopics
Usemultipleinheritance,automaticmethods,and
referencestofilehandles.

Chapter15,Exporter
Howuseworks,howwecandecidewhattoexport,andhow
wecancreateourownimportroutines.

Chapter16,WritingaDistribution
Packageamoduleforsharing,includingportableinstallation


instructions.

Chapter17,EssentialTesting
Testyourcodetoensureitdoeswhatyouwantittodo.

Chapter18,AdvancedTesting
Testcomplexaspectsofcodeandmeta-codethingssuchas
documentationandtestcoverage.

Chapter19,ContributingtoCPAN
ShareyourworkwiththeworldbyuploadingittoCPAN.

Appendix,AnswerstoExercises
Wheretogotogetanswers.


ConventionsUsedinThisBook
Thefollowingtypographicconventionsareusedinthisbook:

Constantwidth
Usedforfunctionnames,modulenames,filenames,
environmentvariables,codesnippets,andotherliteraltext

Italics
Usedforemphasisandfornewtermswheretheyare
defined




UsingCodeExamples
Thisbookisheretohelpyougetyourjobdone.Ingeneral,you
mayusethecodeinthisbookinyourprogramsand
documentation.YoudonotneedtocontactO'Reillyfor
permissionunlessyou'rereproducingasignificantportionofthe
code.Forexample,writingaprogramthatusesseveralchunks
ofcodefromthisbookdoesnotrequirepermission.Sellingor
distributingaCD-ROMofexamplesfromO'Reillybooksdoes
requirepermission.Answeringaquestionbycitingthisbook
andquotingexamplecodedoesnotrequirepermission.
Incorporatingasignificantamountofexamplecodefromthis
bookintoyourproduct'sdocumentationdoesrequire
permission.
Weappreciate,butdonotrequire,attribution.Anattribution
usuallyincludesthetitle,author,publisher,andISBN.For
example:IntermediatePerl,byRandalL.Schwartz,briandfoy,
andTomPhoenix.Copyright2006O'ReillyMedia,Inc.,0-59610206-2.
Ifyoufeelyouruseofcodeexamplesfallsoutsidefairuseor
thepermissiongivenabove,feelfreetocontactusat
permissions@oreilly.com.




CommentsandQuestions
Pleaseaddresscommentsandquestionsconcerningthisbookto
thepublisher:
O'ReillyMedia
1005GravensteinHighwayNorth
Sebastopol,CA95472
(800)998-9938(intheUnitedStatesorCanada)
(707)829-0515(international/local)
(707)829-0104(fax)
Thewebpageforthisbook,whichlistserrata,examples,orany
additionalinformation,canbefoundat:
http://www.oreilly.com/catalog/intermediateperl
Tocommentorasktechnicalquestionsaboutthisbook,send
emailto:
bookquestions@oreilly.com
Formoreinformationaboutbooks,conferences,Resource
Centers,andtheO'ReillyNetwork,seetheO'Reillywebsiteat:
http://www.oreilly.com


Safari®Enabled

WhenyouseeaSafari®Enabledicononthecoverof
yourfavoritetechnologybook,itmeansthebookisavailable
onlinethroughtheO'ReillyNetworkSafariBookshelf.Safari
offersasolutionthat'sbetterthane-books.It'savirtuallibrary
thatletsyoueasilysearchthousandsoftoptechnologybooks,
cutandpastecodesamples,downloadchapters,andfindquick
answerswhenyouneedthemostaccurate,currentinformation.
Tryitforfreeathttp://safari.oreilly.com.




Acknowledgments
FromRandal.IntheprefaceofthefirsteditionofLearning
Perl,IacknowledgedtheBeavertonMcMenamin'sCedarHills
Pub[*]justdownthestreetfrommyhouseforthe"rent-free
booth-officespace"whileIwrotemostofthedraftonmy
Powerbook140.Well,likewearingyourluckysockseveryday
whenyourfavoriteteamisintheplay-offs,Iwrotenearlyallof
thisbook(includingthesewords)atthesamebrewpub,in
hopesthatthelightofsuccessofthefirstbookwillshineonme
twice.(AsIupdatethisprefaceforthesecondedition,Icansee
thatmyluckysocksdoindeedwork!)
[*]http://www.mcmenamins.com/

ThisMcM'shasthesamegreatlocalmicrobrewbeerandgreasy
sandwiches,butthey'vegottenridofmyfavoritepizzabread,
replacingitwithnewitemslikemarionberrycobbler(alocal
treat)andspicyjambalaya.(Andtheyaddedtwoboothsand
putinsomepooltables.)Also,insteadofthePowerbook140,
I'musingaTitaniumPowerbook,with1,000timesmoredisk,
500timesmorememory,anda200-times-fasterCPUrunninga
realUnix-basedoperatingsystem(OSX)insteadofthelimited
MacOS.Ialsouploadedallofthedraftsections(includingthis
one)overmy144Kcell-phonemodemandemailedthem
directlytothereviewers,insteadofhavingtowaittorushhome
tomy9600-baudexternalmodemandphoneline.Howtimes
havechanged!
So,thanksonceagaintothestaffoftheMcMenamin'sCedar
HillsPubfortheboothspaceandhospitality.
LikethefourtheditionofLearningPerl,Ialsoowemuchofwhat
I'msayinghereandhowI'msayingittothestudentsof
StonehengeConsultingServices,whohavegivenme


immediate,precisefeedback(bytheirglazedeyesand
awkwardlyconstructedquestions)whenIwasexceedingthe
"huh?"factorthreshold.Withthatfeedbackovermanydozens
ofpresentations,Iwasabletokeeprefiningandrefactoringthe
materialsthatpavedthewayforthisbook.
Speakingofwhich,thosematerialsstartedasahalf-day
"What'snewinPerl5?"summarycommissionedbyMargie
LevineofSiliconGraphics,inadditiontomyfrequently
presentedon-site,four-dayLlamacourse(targetedprimarilyfor
PerlVersion4atthetime).Eventually,Igottheideatobeefup
thosenotesintoafullcourseandenlistedfellowStonehenge
presenterJosephHallforthetask.(He'stheonewhoselected
theuniversefromwhichtheexamplesaredrawn.)Joseph
developedatwo-daycourseforStonehengeinparallelwithhis
excellentEffectivePerlProgrammingbook,whichwethenused
asthecoursetextbook(untilnow).
OtherStonehengeinstructorshavealsodabbledabitinthe
"Packages,References,Objects,andModules"courseoverthe
years,includingChipSalzenbergandTadMcClellan.Butthe
bulkoftherecentchangeshavebeentheresponsibilityofmy
seniortrainer,TomPhoenix,whohasbeen"Stonehenge
employeeofthemonth"sooftenthatImayhavetofinallygive
upmypreferredparkingspace.Tommanagesthematerials
(justasTadmanagesoperations)soIcanfocusonbeingthe
presidentandthejanitorofStonehenge.
TomPhoenixcontributedmostexercisesinthisbookanda
timelysetofreviewnotesduringmywritingprocess,including
entireparagraphsformetojustinsertinplaceofthedrivelI
hadwritten.Weworkwellasateam,bothintheclassroomand
inourjointwritingefforts.Itisforthiseffortthatwe've
acknowledgedTomasacoauthor,butI'lltakedirectblamefor
anypartsofthebookyouenduphating:noneofthatcould
havepossiblybeenTom'sfault.
Andlastbutnotleast,aspecialthankstomybusinesspartner,


briandfoy,whoherdedthisbookintoitssecondrevisionand
wrotemostofthechangesbetweenthepreviouseditionand
thisedition.
Ofcourse,abookisnothingwithoutasubjectandadistribution
channel,andforthatImustacknowledgelongtimeassociates
LarryWallandTimO'Reilly.Thanks,guys,forcreatingan
industrythathaspaidformyessentials,discretionary
purchases,anddreamsfornearly15years.
And,asalways,aspecialthankstoLyleandJackforteaching
menearlyeverythingIknowaboutwritingandconvincingme
thatIwasmuchmorethanaprogrammerwhomightlearnto
write:Iwasalsoawriterwhohappenedtoknowhowto
program.Thankyou.
Andtoyou,thereaderofthisbook,forwhomItoiledawaythe
countlesshourswhilesippingacoldmicrobrewandscarfing
downapieceofincrediblecheesecake,tryingtoavoidspilling
onmylaptopkeyboard:thankyouforreadingwhatI've
written.IsincerelyhopeI'vecontributed(inatleastasmall
way)toyourPerlproficiency.Ifyouevermeetmeonthe
street,pleasesay"Hi."[*]I'dlikethat.Thankyou.
[*]Andyes,youcanaskaPerlquestionatthesametime.Idon'tmind.

Frombrian.IhavetothankRandalfirst,sinceIlearnedPerl
fromthefirsteditionofLearningPerl,andlearnedtherest
teachingtheLlamaandAlpacacoursesforStonehenge
Consulting.Teachingisoftenthebestwaytolearn.
IconvincedRandalthatweshouldupdateLearningPerl,and
whenwegotdonewiththat,Itoldhimitwastimetoupdate
thisbook.Oureditor,AllisonRandal,agreedanddidthebest
shecouldtokeepusonschedule.
Specialnon-PerlthankstoStacey,Buster,Mimi,Roscoe,Amelia,
Lila,andeveryoneelsewhotriedtodistractmewhileIwas


Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay

×

×