Intermediate Perl 2e
By: Randal L. Schwartz, Brian D Foy (Contribution by), Tom Phoenix (Contribution by)
Paperback | 7 August 2012 | Edition Number 2
At a Glance
376 Pages
Revised
24 x 18 x 2
Paperback
RRP $85.50
$39.75
54%OFF
or 4 interest-free payments of $9.94 with
 orÂ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
Foreword | p. xi |
Preface | p. xiii |
Introduction | p. 1 |
What Should You Know Already? | p. 2 |
strict and warnings | p. 2 |
Perl v5.14 | p. 3 |
A Note on Versions | p. 4 |
What About All Those Footnotes? | p. 4 |
What's With the Exercises? | p. 4 |
How to Get Help | p. 5 |
What If I'm a Perl Course Instructor? | p. 5 |
Exercises | p. 6 |
Using Modules | p. 7 |
The Standard Distribution | p. 7 |
Exploring CPAN | p. 8 |
Using Modules | p. 9 |
Functional Interfaces | p. 10 |
Selecting What to Import | p. 11 |
Object-Oriented Interfaces | p. 12 |
A More Typical Object-Oriented Module: Math::BigInt | p. 12 |
Fancier Output with Modules | p. 13 |
What's in Core? | p. 14 |
The Comprehensive Perl Archive Network | p. 15 |
Installing Modules from CPAN | p. 16 |
CPANminus | p. 17 |
Installing Modules Manually | p. 17 |
Setting the Path at the Right Time | p. 18 |
Setting the Path Outside the Program | p. 21 |
Extending @INC with PERL5LIB | p. 21 |
Extending @INC on the Command Line | p. 22 |
local::lib | p. 22 |
Exercises | p. 23 |
Intermediate Foundations | p. 25 |
List Operators | p. 25 |
List Filtering with grep | p. 26 |
Transforming Lists with map | p. 28 |
Trapping Errors with eval | p. 29 |
Dynamic Code with eval | p. 31 |
The do Block | p. 32 |
Exercises | p. 33 |
Introduction to References | p. 35 |
Doing the Same Task on Many Arrays | p. 35 |
PeGS: Perl Graphical Structures | p. 37 |
Taking a Reference to an Array | p. 38 |
Dereferencing the Array Reference | p. 41 |
Getting Our Braces Off | p. 42 |
Modifying the Array | p. 43 |
Nested Data Structures | p. 44 |
Simplifying Nested Element References with Arrows | p. 45 |
References to Hashes | p. 47 |
Checking Reference Types | p. 50 |
Exercises | p. 52 |
References and Scoping | p. 53 |
More than One Reference to Data | p. 53 |
What If That Was the Name? | p. 54 |
Reference Counting and Nested Data Structures | p. 55 |
When Reference Counting Goes Bad | p. 57 |
Creating an Anonymous Array Directly | p. 59 |
Creating an Anonymous Hash | p. 61 |
Autovivification | p. 63 |
Autovivification and Hashes | p. 66 |
Exercises | p. 68 |
Manipulating Complex Data Structures | p. 71 |
Using the Debugger to View Complex Data | p. 71 |
Viewing Complex Data with Data::Dumper | p. 75 |
Other Dumpers | p. 77 |
Marshalling Data | p. 78 |
Storing Complex Data with Storable | p. 80 |
YAML | p. 85 |
JSON | p. 85 |
Using the map and grep Operators | p. 86 |
Applying a Bit of Indirection | p. 86 |
Selecting and Altering Complex Data | p. 88 |
Exercises | p. 90 |
Subroutine References | p. 91 |
Referencing a Named Subroutine | p. 91 |
Anonymous Subroutines | p. 96 |
Callbacks | p. 97 |
Closures | p. 98 |
Returning a Subroutine from a Subroutine | p. 100 |
Closure Variables as Inputs | p. 103 |
Closure Variables as Static Local Variables | p. 104 |
state Variables | p. 105 |
Finding Out Who We Are | p. 107 |
Enchanting Subroutines | p. 108 |
Dumping Closures | p. 111 |
Exercise | p. 112 |
Filehandle References | p. 115 |
The Old Way | p. 115 |
The Improved Way | p. 116 |
Filehandles to Strings | p. 118 |
Processing Strings Line by Line | p. 119 |
Collections of Filehandles | p. 120 |
IO::Handle and Friends | p. 121 |
IO::File | p. 121 |
IO::Scalar | p. 122 |
IO::Tee | p. 123 |
IO::Pipe | p. 124 |
IO::Null and IO::Interactive | p. 125 |
Directory Handles | p. 126 |
Directory Handle References | p. 126 |
Exercises | p. 127 |
Regular Expression References | p. 129 |
Before Regular Expression References | p. 129 |
Precompiled Patterns | p. 131 |
Regular Expression Options | p. 132 |
Applying Regex References | p. 132 |
Regexes as Scalars | p. 133 |
Build Up Regular Expressions | p. 136 |
Regex-Creating Modules | p. 137 |
Using Common Patterns | p. 137 |
Assembling Regular Expressions | p. 139 |
Exercises | p. 140 |
Practical Reference Tricks | p. 141 |
Fancier Sorting | p. 141 |
Sorting with Indices | p. 143 |
Sorting Efficiently | p. 144 |
The Schwartzian Transform | p. 145 |
Multilevel Sort with the Schwartzian Transform | p. 147 |
Recursively Defined Data | p. 147 |
Building Recursively Defined Data | p. 149 |
Displaying Recursively Defined Data | p. 152 |
Avoiding Recursion | p. 153 |
The Breadth-First Solution | p. 154 |
Exercises | p. 156 |
Building Larger Programs | p. 159 |
The Cure for the Common Code | p. 159 |
Inserting Code with eval | p. 160 |
Using do | p. 161 |
Using require | p. 163 |
The Problem of Namespace Collisions | p. 164 |
Packages as Namespace Separators | p. 165 |
Scope of a Package Directive | p. 167 |
Packages and Lexicals | p. 168 |
Package Blocks | p. 169 |
Exercises | p. 170 |
Creating Your Own Perl Distribution | p. 173 |
Perl's Two Build Systems | p. 173 |
Inside Makefile.PL | p. 174 |
Inside Build.PL | p. 175 |
Our First Distribution | p. 176 |
h2xs | p. 176 |
Module::Starter | p. 177 |
Custom Templates | p. 178 |
Inside Your Perl Distribution | p. 178 |
The META File | p. 180 |
Adding Additional Modules | p. 181 |
Inside a Module | p. 182 |
Plain Ol' Documentation | p. 184 |
Pod Command Paragraphs | p. 185 |
Pod Paragraphs | p. 186 |
Pod Formatting Codes | p. 186 |
Checking the Pod Format | p. 187 |
The Module Code | p. 187 |
Module Building Summary | p. 188 |
Creating a Module::Build Distribution | p. 188 |
Creating a ExtUtils::Makemaker Distribution | p. 189 |
Exercises | p. 189 |
Introduction to Objects | p. 191 |
If We Could Talk to the Animals… | p. 191 |
Introducing the Method Invocation Arrow | p. 193 |
The Extra Parameter of Method Invocation | p. 194 |
Calling a Second Method to Simplify Things | p. 195 |
A Few Notes About @ISA | p. 197 |
Overriding the Methods | p. 198 |
Starting the Search from a Different Place | p. 200 |
The SUPER Way of Doing Things | p. 200 |
What to Do with @_ | p. 201 |
Where We Are | p. 201 |
Our Barnyard Summary | p. 202 |
Exercises | p. 203 |
Introduction to Testing | p. 205 |
Why Should We Test? | p. 205 |
The Perl Testing Process | p. 206 |
Test Anywhere Protocol | p. 206 |
The Art of Testing | p. 208 |
A Test Example | p. 209 |
The Test Harness | p. 210 |
The Standard Tests | p. 211 |
Checking that Modules Compile | p. 212 |
The Boilerplate Tests | p. 213 |
The Pod Tests | p. 216 |
Adding Our First Tests | p. 217 |
Measuring Our Test Coverage | p. 220 |
Subroutine Coverage | p. 221 |
Statement Coverage | p. 221 |
Branch Coverage | p. 221 |
Conditional Coverage | p. 222 |
Exercises | p. 222 |
Objects with Data | p. 225 |
A Horse Is a Horse, of Course of Course-Or Is It? | p. 225 |
Invoking an Instance Method | p. 227 |
Accessing the Instance Data | p. 228 |
How to Build a Horse | p. 228 |
Inheriting the Constructor | p. 229 |
Making a Method Work with Either Classes or Instances | p. 230 |
Adding Parameters to a Method | p. 230 |
More Interesting Instances | p. 231 |
A Horse of a Different Color | p. 232 |
Getting Our Deposit Back | p. 233 |
Don't Look Inside the Box | p. 234 |
Faster Getters and Setters | p. 235 |
Getters that Double as Setters | p. 236 |
Restricting a Method to Class Only or Instance Only | p. 236 |
Exercise | p. 237 |
Some Advanced Object Topics | p. 239 |
UNIVERSAL Methods | p. 239 |
Testing Our Objects for Good Behavior | p. 240 |
The Last Resort | p. 242 |
Using AUTOLOAD for Accessors | p. 243 |
Creating Getters and Setters More Easily | p. 244 |
Multiple Inheritance | p. 246 |
Exercises | p. 247 |
Exporter | p. 249 |
What use Is Doing | p. 249 |
Importing with Exporter | p. 250 |
@EXPORT and @EXPORT_OK | p. 251 |
Grouping with %EXPORT_TAGS | p. 252 |
Custom Import Routines | p. 254 |
Exercises | p. 256 |
Object Destruction | p. 257 |
Cleaning Up After Ourselves | p. 257 |
Nested Object Destruction | p. 259 |
Beating a Dead Horse | p. 262 |
Indirect Object Notation | p. 263 |
Additional Instance Variables in Subclasses | p. 265 |
Using Class Variables | p. 267 |
Weakening the Argument | p. 268 |
Exercise | p. 270 |
Introduction to Moose | p. 273 |
Making Animals with Moose | p. 273 |
Roles Instead of Inheritance | p. 276 |
Default Values | p. 277 |
Constraining Values | p. 278 |
Wrapping Methods | p. 279 |
Read-Only Attributes | p. 281 |
Improving the Race Horse | p. 281 |
Further Study | p. 283 |
Exercises | p. 283 |
Advancing Testing | p. 285 |
Skipping Tests | p. 285 |
Testing Object-Oriented Features | p. 286 |
Grouping Tests | p. 287 |
Testing Large Strings | p. 288 |
Testing Files | p. 289 |
Testing STDOUT or STDERR | p. 290 |
Using Mock Objects | p. 293 |
Writing Our Own Test::* Modules | p. 294 |
Exercises | p. 297 |
Contributing to CPAN | p. 299 |
The Comprehensive Perl Archive Network | p. 299 |
Getting Prepared | p. 299 |
How PAUSE Works | p. 300 |
The Indexer | p. 301 |
Module Maintainers | p. 302 |
Before We Start Work | p. 303 |
Preparing the Distribution | p. 303 |
Create or Update the README | p. 304 |
Check the Build File | p. 304 |
Update the Manifest | p. 304 |
Increase the Version String | p. 306 |
Test the Distribution | p. 306 |
Uploading the Distribution | p. 307 |
Testing on Multiple Platforms | p. 307 |
Announcing the Module | p. 308 |
Exercises | p. 308 |
Appendix: Answers to Exercises | p. 311 |
Index of Modules in this Book | p. 359 |
Index | p. 363 |
Table of Contents provided by Ingram. All Rights Reserved. |
ISBN: 9781449393090
ISBN-10: 1449393098
Series: OREILLY
Published: 7th August 2012
Format: Paperback
Language: English
Number of Pages: 376
Audience: General Adult
Publisher: O'Reilly Media, Inc, USA
Country of Publication: US
Edition Number: 2
Edition Type: Revised
Dimensions (cm): 24 x 18 x 2
Weight (kg): 0.71
Shipping
Standard Shipping | Express Shipping | |
---|---|---|
Metro postcodes: | $9.99 | $14.95 |
Regional postcodes: | $9.99 | $14.95 |
Rural postcodes: | $9.99 | $14.95 |
How to return your order
At Booktopia, we offer hassle-free returns in accordance with our returns policy. If you wish to return an item, please get in touch with Booktopia Customer Care.
Additional postage charges may be applicable.
Defective items
If there is a problem with any of the items received for your order then the Booktopia Customer Care team is ready to assist you.
For more info please visit our Help Centre.
You Can Find This Book In
Architecture Patterns with Python
Enabling Test-Driven Development, Domain-Driven Design, and Event-Driven Microservices
Paperback
RRP $125.50
$55.25
OFF
BLACK FRIDAY
RRP $95.00
$38.00
OFF
Hadoop : The Definitive Guide
Storage and Analysis at Internet Scale : 4th Edition Revised and Updated
Paperback
RRP $123.50
$54.40
OFF