9781449393090

Intermediate Perl

by ; ;
  • ISBN13:

    9781449393090

  • ISBN10:

    1449393098

  • Edition: 2nd
  • Format: Paperback
  • Copyright: 8/13/2012
  • Publisher: Oreilly & Associates Inc
  • Purchase Benefits
  • Free Shipping On Orders Over $59!
    Your order must be $59 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $44.99 Save up to $6.75
  • Buy New
    $38.24

    IN STOCK USUALLY SHIPS IN 24-48 HOURS

Supplemental Materials

What is included with this book?

  • The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any access cards, study guides, lab manuals, CDs, etc.
  • The eBook copy of this book is not guaranteed to include any supplemental materials. Typically, only the book itself is included. This is true even if the title states it includes any access cards, study guides, lab manuals, CDs, etc.

Summary

Get a clear roadmap for improving your skills with Intermediate Perl, and gain working knowledge of Perl's objects, references, and modules-ingredients that make the language so versatile and effective. Written by the authors of the bestselling Llama book, Learning Perl, and updated for Perl 5.14, this book offers a gentle but thorough introduction to intermediate programming in Perl. Each chapter is 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. If you're familiar with the material in Learning Perl and have the ambition learn more, this book will take you much further into Perl's capabilities. Topics include: Packages and namespaces References and scoping, including regular expression references Manipulating complex data structures Object-oriented programming Writing and using modules Testing Perl code Contributing to CPAN

Author Biography

Randal L. Schwartz is skilled in software design, system administration, security, technical writing, and training. He's coauthored several "must-have" books, including Learning Perl, Programming Perl, Intermediate Perl, and Mastering Perl (all O'Reilly). brian d foy, a prolific Perl trainer and writer, runs The Perl Review to help people use and understand Perl. He's the co-author of Learning Perl, Intermediate Perl, Mastering Perl, and Effective Perl Programming (Addison-Wesley). Tom Phoenix teaches Perl at Stonehenge Consulting Services, and answers questions on Usenet's comp.lang. perl.misc and comp.lang. perl.moderated newsgroups. Coauthor of Intermediate Perl, he is also a Perl contributor.

Table of Contents

Forewordp. xi
Prefacep. xiii
Introductionp. 1
What Should You Know Already?p. 2
strict and warningsp. 2
Perl v5.14p. 3
A Note on Versionsp. 4
What About All Those Footnotes?p. 4
What's With the Exercises?p. 4
How to Get Helpp. 5
What If I'm a Perl Course Instructor?p. 5
Exercisesp. 6
Using Modulesp. 7
The Standard Distributionp. 7
Exploring CPANp. 8
Using Modulesp. 9
Functional Interfacesp. 10
Selecting What to Importp. 11
Object-Oriented Interfacesp. 12
A More Typical Object-Oriented Module: Math::BigIntp. 12
Fancier Output with Modulesp. 13
What's in Core?p. 14
The Comprehensive Perl Archive Networkp. 15
Installing Modules from CPANp. 16
CPANminusp. 17
Installing Modules Manuallyp. 17
Setting the Path at the Right Timep. 18
Setting the Path Outside the Programp. 21
Extending @INC with PERL5LIBp. 21
Extending @INC on the Command Linep. 22
local::libp. 22
Exercisesp. 23
Intermediate Foundationsp. 25
List Operatorsp. 25
List Filtering with grepp. 26
Transforming Lists with mapp. 28
Trapping Errors with evalp. 29
Dynamic Code with evalp. 31
The do Blockp. 32
Exercisesp. 33
Introduction to Referencesp. 35
Doing the Same Task on Many Arraysp. 35
PeGS: Perl Graphical Structuresp. 37
Taking a Reference to an Arrayp. 38
Dereferencing the Array Referencep. 41
Getting Our Braces Offp. 42
Modifying the Arrayp. 43
Nested Data Structuresp. 44
Simplifying Nested Element References with Arrowsp. 45
References to Hashesp. 47
Checking Reference Typesp. 50
Exercisesp. 52
References and Scopingp. 53
More than One Reference to Datap. 53
What If That Was the Name?p. 54
Reference Counting and Nested Data Structuresp. 55
When Reference Counting Goes Badp. 57
Creating an Anonymous Array Directlyp. 59
Creating an Anonymous Hashp. 61
Autovivificationp. 63
Autovivification and Hashesp. 66
Exercisesp. 68
Manipulating Complex Data Structuresp. 71
Using the Debugger to View Complex Datap. 71
Viewing Complex Data with Data::Dumperp. 75
Other Dumpersp. 77
Marshalling Datap. 78
Storing Complex Data with Storablep. 80
YAMLp. 85
JSONp. 85
Using the map and grep Operatorsp. 86
Applying a Bit of Indirectionp. 86
Selecting and Altering Complex Datap. 88
Exercisesp. 90
Subroutine Referencesp. 91
Referencing a Named Subroutinep. 91
Anonymous Subroutinesp. 96
Callbacksp. 97
Closuresp. 98
Returning a Subroutine from a Subroutinep. 100
Closure Variables as Inputsp. 103
Closure Variables as Static Local Variablesp. 104
state Variablesp. 105
Finding Out Who We Arep. 107
Enchanting Subroutinesp. 108
Dumping Closuresp. 111
Exercisep. 112
Filehandle Referencesp. 115
The Old Wayp. 115
The Improved Wayp. 116
Filehandles to Stringsp. 118
Processing Strings Line by Linep. 119
Collections of Filehandlesp. 120
IO::Handle and Friendsp. 121
IO::Filep. 121
IO::Scalarp. 122
IO::Teep. 123
IO::Pipep. 124
IO::Null and IO::Interactivep. 125
Directory Handlesp. 126
Directory Handle Referencesp. 126
Exercisesp. 127
Regular Expression Referencesp. 129
Before Regular Expression Referencesp. 129
Precompiled Patternsp. 131
Regular Expression Optionsp. 132
Applying Regex Referencesp. 132
Regexes as Scalarsp. 133
Build Up Regular Expressionsp. 136
Regex-Creating Modulesp. 137
Using Common Patternsp. 137
Assembling Regular Expressionsp. 139
Exercisesp. 140
Practical Reference Tricksp. 141
Fancier Sortingp. 141
Sorting with Indicesp. 143
Sorting Efficientlyp. 144
The Schwartzian Transformp. 145
Multilevel Sort with the Schwartzian Transformp. 147
Recursively Defined Datap. 147
Building Recursively Defined Datap. 149
Displaying Recursively Defined Datap. 152
Avoiding Recursionp. 153
The Breadth-First Solutionp. 154
Exercisesp. 156
Building Larger Programsp. 159
The Cure for the Common Codep. 159
Inserting Code with evalp. 160
Using dop. 161
Using requirep. 163
The Problem of Namespace Collisionsp. 164
Packages as Namespace Separatorsp. 165
Scope of a Package Directivep. 167
Packages and Lexicalsp. 168
Package Blocksp. 169
Exercisesp. 170
Creating Your Own Perl Distributionp. 173
Perl's Two Build Systemsp. 173
Inside Makefile.PLp. 174
Inside Build.PLp. 175
Our First Distributionp. 176
h2xsp. 176
Module::Starterp. 177
Custom Templatesp. 178
Inside Your Perl Distributionp. 178
The META Filep. 180
Adding Additional Modulesp. 181
Inside a Modulep. 182
Plain Ol' Documentationp. 184
Pod Command Paragraphsp. 185
Pod Paragraphsp. 186
Pod Formatting Codesp. 186
Checking the Pod Formatp. 187
The Module Codep. 187
Module Building Summaryp. 188
Creating a Module::Build Distributionp. 188
Creating a ExtUtils::Makemaker Distributionp. 189
Exercisesp. 189
Introduction to Objectsp. 191
If We Could Talk to the Animals…p. 191
Introducing the Method Invocation Arrowp. 193
The Extra Parameter of Method Invocationp. 194
Calling a Second Method to Simplify Thingsp. 195
A Few Notes About @ISAp. 197
Overriding the Methodsp. 198
Starting the Search from a Different Placep. 200
The SUPER Way of Doing Thingsp. 200
What to Do with @_p. 201
Where We Arep. 201
Our Barnyard Summaryp. 202
Exercisesp. 203
Introduction to Testingp. 205
Why Should We Test?p. 205
The Perl Testing Processp. 206
Test Anywhere Protocolp. 206
The Art of Testingp. 208
A Test Examplep. 209
The Test Harnessp. 210
The Standard Testsp. 211
Checking that Modules Compilep. 212
The Boilerplate Testsp. 213
The Pod Testsp. 216
Adding Our First Testsp. 217
Measuring Our Test Coveragep. 220
Subroutine Coveragep. 221
Statement Coveragep. 221
Branch Coveragep. 221
Conditional Coveragep. 222
Exercisesp. 222
Objects with Datap. 225
A Horse Is a Horse, of Course of Course-Or Is It?p. 225
Invoking an Instance Methodp. 227
Accessing the Instance Datap. 228
How to Build a Horsep. 228
Inheriting the Constructorp. 229
Making a Method Work with Either Classes or Instancesp. 230
Adding Parameters to a Methodp. 230
More Interesting Instancesp. 231
A Horse of a Different Colorp. 232
Getting Our Deposit Backp. 233
Don't Look Inside the Boxp. 234
Faster Getters and Settersp. 235
Getters that Double as Settersp. 236
Restricting a Method to Class Only or Instance Onlyp. 236
Exercisep. 237
Some Advanced Object Topicsp. 239
UNIVERSAL Methodsp. 239
Testing Our Objects for Good Behaviorp. 240
The Last Resortp. 242
Using AUTOLOAD for Accessorsp. 243
Creating Getters and Setters More Easilyp. 244
Multiple Inheritancep. 246
Exercisesp. 247
Exporterp. 249
What use Is Doingp. 249
Importing with Exporterp. 250
@EXPORT and @EXPORT_OKp. 251
Grouping with %EXPORT_TAGSp. 252
Custom Import Routinesp. 254
Exercisesp. 256
Object Destructionp. 257
Cleaning Up After Ourselvesp. 257
Nested Object Destructionp. 259
Beating a Dead Horsep. 262
Indirect Object Notationp. 263
Additional Instance Variables in Subclassesp. 265
Using Class Variablesp. 267
Weakening the Argumentp. 268
Exercisep. 270
Introduction to Moosep. 273
Making Animals with Moosep. 273
Roles Instead of Inheritancep. 276
Default Valuesp. 277
Constraining Valuesp. 278
Wrapping Methodsp. 279
Read-Only Attributesp. 281
Improving the Race Horsep. 281
Further Studyp. 283
Exercisesp. 283
Advancing Testingp. 285
Skipping Testsp. 285
Testing Object-Oriented Featuresp. 286
Grouping Testsp. 287
Testing Large Stringsp. 288
Testing Filesp. 289
Testing STDOUT or STDERRp. 290
Using Mock Objectsp. 293
Writing Our Own Test::* Modulesp. 294
Exercisesp. 297
Contributing to CPANp. 299
The Comprehensive Perl Archive Networkp. 299
Getting Preparedp. 299
How PAUSE Worksp. 300
The Indexerp. 301
Module Maintainersp. 302
Before We Start Workp. 303
Preparing the Distributionp. 303
Create or Update the READMEp. 304
Check the Build Filep. 304
Update the Manifestp. 304
Increase the Version Stringp. 306
Test the Distributionp. 306
Uploading the Distributionp. 307
Testing on Multiple Platformsp. 307
Announcing the Modulep. 308
Exercisesp. 308
Appendix: Answers to Exercisesp. 311
Index of Modules in this Bookp. 359
Indexp. 363
Table of Contents provided by Ingram. All Rights Reserved.

Rewards Program

Write a Review