Intermediate Perl
O'Reilly Media (Verlag)
978-1-4493-9309-0 (ISBN)
Each chapter is small enough to be read in just an hour or two, ending with exercises to help you practice what you’ve learned. If you’re familiar with the material in Learning Perl and have the ambition to go further, Intermediate Perl will teach you most of the core Perl language concepts you need for writing robust programs on any platform.
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
Just like Learning Perl, material in this book closely follows the popular introductory Perl course the authors have taught since 1991. This second edition covers recent changes to the language up to version 5.14.
Randal L. Schwartz is a two-decade veteran of the software industry. He is skilled in software design, system administration, security, technical writing, and training. Randal has coauthored the "must-have" standards: Programming Perl, Learning Perl, Learning Perl for Win32 Systems, and Effective Perl Learning, and is a regular columnist for WebTechniques, PerformanceComputing, SysAdmin, and Linux magazines. He is also a frequent contributor to the Perl newsgroups, and has moderated comp.lang.perl.announce since its inception. His offbeat humor and technical mastery have reached legendary proportions worldwide (but he probably started some of those legends himself). Randal's desire to give back to the Perl community inspired him to help create and provide initial funding for The Perl Institute. He is also a founding board member of the Perl Mongers (perl.org), the worldwide Perl grassroots advocacy organization. Since 1985, Randal has owned and operated Stonehenge Consulting Services, Inc. Randal can be reached for comment at merlyn@stonehenge.com or (503) 777-0095, and welcomes questions on Perl and other related topics.
brian d foy has been an instructor for Stonehenge Consulting Services since 1998, a Perl user since he was a physics graduate student, and a die-hard Mac user since he first owned a computer. He founded the first Perl user group, the New York Perl Mongers, as well as the Perl advocacy nonprofit Perl Mongers, Inc., which helped form more than 200 Perl user groups across the globe. He maintains the perlfaq portions of the core Perl documentation, several modules on CPAN, and some stand-alone scripts. He's the publisher of The Perl Review, a magazine devoted to Perl, and is a frequent speaker at conferences including the Perl Conference, Perl University, MarcusEvans BioInformatics '02, and YAPC. His writings on Perl appear in The O'Reilly Network, The Perl Journal, Dr. Dobbs, and The Perl Review, on use.perl.org, and in several Perl usenet groups.
Tom Phoenix has been working in the field of education since 1982. After more than thirteen years of dissections, explosions, work with interesting animals, and high-voltage sparks during his work at a science museum, he started teaching Perl classes for Stonehenge Consulting Services, where he's worked since 1996. Since then, he has traveled to many interesting locations, so you might see him soon at a Perl Mongers' meeting. When he has time, he answers questions on Usenet's comp.lang.perl.misc and comp.lang.perl.moderated newsgroups, and contributes to the development and usefulness of Perl. Besides his work with Perl, Perl hackers, and related topics, Tom spends his time on amateur cryptography and speaking Esperanto. His home is in Portland, Oregon.
Chapter 1 Introduction
What Should You Know Already?
strict and warnings
Perl v5.14
What About All Those Footnotes?
What’s With the Exercises?
How to Get Help
What If I’m a Perl Course Instructor?
Exercises
Chapter 2 Using Modules
The Standard Distribution
Exploring CPAN
Using Modules
Functional Interfaces
Object-Oriented Interfaces
What’s in Core?
The Comprehensive Perl Archive Network
Installing Modules from CPAN
Setting the Path at the Right Time
Setting the Path Outside the Program
local::lib
Exercises
Chapter 3 Intermediate Foundations
List Operators
Trapping Errors with eval
Dynamic Code with eval
The do Block
Exercises
Chapter 4 Introduction to References
Doing the Same Task on Many Arrays
PeGS: Perl Graphical Structures
Taking a Reference to an Array
Dereferencing the Array Reference
Getting Our Braces Off
Modifying the Array
Nested Data Structures
Simplifying Nested Element References with Arrows
References to Hashes
Checking Reference Types
Exercises
Chapter 5 References and Scoping
More than One Reference to Data
What If That Was the Name?
Reference Counting and Nested Data Structures
When Reference Counting Goes Bad
Creating an Anonymous Array Directly
Creating an Anonymous Hash
Autovivification
Autovivification and Hashes
Exercises
Chapter 6 Manipulating Complex Data Structures
Using the Debugger to View Complex Data
Viewing Complex Data with Data::Dumper
Marshalling Data
Using the map and grep Operators
Applying a Bit of Indirection
Selecting and Altering Complex Data
Exercises
Chapter 7 Subroutine References
Referencing a Named Subroutine
Anonymous Subroutines
Callbacks
Closures
Returning a Subroutine from a Subroutine
Closure Variables as Inputs
Closure Variables as Static Local Variables
Finding Out Who We Are
Exercise
Chapter 8 Filehandle References
The Old Way
The Improved Way
Filehandles to Strings
Collections of Filehandles
IO::Handle and Friends
Directory Handles
Exercises
Chapter 9 Regular Expression References
Before Regular Expression References
Precompiled Patterns
Regexes as Scalars
Build Up Regular Expressions
Regex-Creating Modules
Exercises
Chapter 10 Practical Reference Tricks
Fancier Sorting
Sorting with Indices
Sorting Efficiently
The Schwartzian Transform
Multilevel Sort with the Schwartzian Transform
Recursively Defined Data
Building Recursively Defined Data
Displaying Recursively Defined Data
Avoiding Recursion
Exercises
Chapter 11 Building Larger Programs
The Cure for the Common Code
Inserting Code with eval
Using do
Using require
The Problem of Namespace Collisions
Packages as Namespace Separators
Scope of a Package Directive
Packages and Lexicals
Package Blocks
Exercises
Chapter 12 Creating Your Own Perl Distribution
Perl’s Two Build Systems
Our First Distribution
Inside Your Perl Distribution
Inside a Module
Plain Ol’ Documentation
The Module Code
Module Building Summary
Exercises
Chapter 13 Introduction to Objects
If We Could Talk to the Animals. . .
Introducing the Method Invocation Arrow
The Extra Parameter of Method Invocation
Calling a Second Method to Simplify Things
A Few Notes About @ISA
Overriding the Methods
Starting the Search from a Different Place
The SUPER Way of Doing Things
What to Do with @_
Where We Are
Our Barnyard Summary
Exercises
Chapter 14 Introduction to Testing
Why Should We Test?
The Perl Testing Process
The Art of Testing
The Test Harness
The Standard Tests
Adding Our First Tests
Measuring Our Test Coverage
Exercises
Chapter 15 Objects with Data
A Horse Is a Horse, of Course of Course—Or Is It?
Invoking an Instance Method
Accessing the Instance Data
How to Build a Horse
Inheriting the Constructor
Making a Method Work with Either Classes or Instances
Adding Parameters to a Method
More Interesting Instances
A Horse of a Different Color
Getting Our Deposit Back
Don’t Look Inside the Box
Faster Getters and Setters
Getters that Double as Setters
Restricting a Method to Class Only or Instance Only
Exercise
Chapter 16 Some Advanced Object Topics
UNIVERSAL Methods
Testing Our Objects for Good Behavior
The Last Resort
Using AUTOLOAD for Accessors
Creating Getters and Setters More Easily
Multiple Inheritance
Exercises
Chapter 17 Exporter
What use Is Doing
Importing with Exporter
@EXPORT and @EXPORT_OK
Grouping with %EXPORT_TAGS
Custom Import Routines
Exercises
Chapter 18 Object Destruction
Cleaning Up After Ourselves
Nested Object Destruction
Beating a Dead Horse
Indirect Object Notation
Additional Instance Variables in Subclasses
Using Class Variables
Weakening the Argument
Exercise
Chapter 19 Introduction to Moose
Making Animals with Moose
Improving the Race Horse
Further Study
Exercises
Chapter 20 Advanced Testing
Skipping Tests
Testing Object-Oriented Features
Grouping Tests
Testing Large Strings
Testing Files
Testing STDOUT or STDERR
Using Mock Objects
Writing Our Own Test::* Modules
Exercises
Chapter 21 Contributing to CPAN
The Comprehensive Perl Archive Network
Getting Prepared
How PAUSE Works
Before We Start Work
Preparing the Distribution
Uploading the Distribution
Testing on Multiple Platforms
Announcing the Module
Exercises
Appendix Answers to Exercises
Answers for Chapter 1
Answers for Chapter 2
Answers for Chapter 3
Answers for Chapter 4
Answers for Chapter 5
Answers for Chapter 6
Answer for Chapter 7
Answers for Chapter 8
Answers for Chapter 9
Answers for Chapter 10
Answers for Chapter 11
Answers for Chapter 12
Answers for Chapter 13
Answers for Chapter 14
Answer for Chapter 15
Answers for Chapter 16
Answers for Chapter 17
Answers for Chapter 18
Answers for Chapter 19
Answers for Chapter 20
Answers for Chapter 21
Index of Modules in this Book
Index
Colophon
Zusatzinfo | Illustrations |
---|---|
Verlagsort | Sebastopol |
Sprache | englisch |
Maße | 178 x 233 mm |
Gewicht | 621 g |
Einbandart | kartoniert |
Themenwelt | Informatik ► Programmiersprachen / -werkzeuge ► Perl |
Mathematik / Informatik ► Informatik ► Web / Internet | |
ISBN-10 | 1-4493-9309-8 / 1449393098 |
ISBN-13 | 978-1-4493-9309-0 / 9781449393090 |
Zustand | Neuware |
Informationen gemäß Produktsicherheitsverordnung (GPSR) | |
Haben Sie eine Frage zum Produkt? |
aus dem Bereich