Intermediate Perl: Beyond The Basics of Learning Perl

Intermediate Perl: Beyond The Basics of Learning Perl

by Randal L. Schwartz, brian d foy, Tom Phoenix
5.0 1

NOOK Book(eBook)

$22.99 $38.99 Save 41% Current price is $22.99, Original price is $38.99. You Save 41%.
View All Available Formats & Editions
Available on Compatible NOOK Devices and the free NOOK Apps.
Want a NOOK ? Explore Now

Overview

Intermediate Perl: Beyond The Basics of Learning Perl by Randal L. Schwartz, brian d foy, Tom Phoenix

This book picks up right where Learning Perl leaves off. With Intermediate Perl, you’ll graduate from short scripts to much larger programs, using features that make Perl a general-purpose language. This gentle but thorough guide introduces you to modules, complex data structures, and object-oriented programming.

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.

Product Details

ISBN-13: 9781449343804
Publisher: O'Reilly Media, Incorporated
Publication date: 07/26/2012
Sold by: Barnes & Noble
Format: NOOK Book
Pages: 396
Sales rank: 429,393
File size: 2 MB

About the Author

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.

Table of Contents

Foreword;
Preface;
Structure of This Book;
Conventions Used in This Book;
Using Code Examples;
Safari® Books Online;
How to Contact Us;
Acknowledgments;
Chapter 1: Introduction;
1.1 What Should You Know Already?;
1.2 strict and warnings;
1.3 Perl v5.14;
1.4 What About All Those Footnotes?;
1.5 What’s With the Exercises?;
1.6 How to Get Help;
1.7 What If I’m a Perl Course Instructor?;
1.8 Exercises;
Chapter 2: Using Modules;
2.1 The Standard Distribution;
2.2 Exploring CPAN;
2.3 Using Modules;
2.4 Functional Interfaces;
2.5 Object-Oriented Interfaces;
2.6 What’s in Core?;
2.7 The Comprehensive Perl Archive Network;
2.8 Installing Modules from CPAN;
2.9 Setting the Path at the Right Time;
2.10 Setting the Path Outside the Program;
2.11 local::lib;
2.12 Exercises;
Chapter 3: Intermediate Foundations;
3.1 List Operators;
3.2 Trapping Errors with eval;
3.3 Dynamic Code with eval;
3.4 The do Block;
3.5 Exercises;
Chapter 4: Introduction to References;
4.1 Doing the Same Task on Many Arrays;
4.2 PeGS: Perl Graphical Structures;
4.3 Taking a Reference to an Array;
4.4 Dereferencing the Array Reference;
4.5 Getting Our Braces Off;
4.6 Modifying the Array;
4.7 Nested Data Structures;
4.8 Simplifying Nested Element References with Arrows;
4.9 References to Hashes;
4.10 Checking Reference Types;
4.11 Exercises;
Chapter 5: References and Scoping;
5.1 More than One Reference to Data;
5.2 What If That Was the Name?;
5.3 Reference Counting and Nested Data Structures;
5.4 When Reference Counting Goes Bad;
5.5 Creating an Anonymous Array Directly;
5.6 Creating an Anonymous Hash;
5.7 Autovivification;
5.8 Autovivification and Hashes;
5.9 Exercises;
Chapter 6: Manipulating Complex Data Structures;
6.1 Using the Debugger to View Complex Data;
6.2 Viewing Complex Data with Data::Dumper;
6.3 Marshalling Data;
6.4 Using the map and grep Operators;
6.5 Applying a Bit of Indirection;
6.6 Selecting and Altering Complex Data;
6.7 Exercises;
Chapter 7: Subroutine References;
7.1 Referencing a Named Subroutine;
7.2 Anonymous Subroutines;
7.3 Callbacks;
7.4 Closures;
7.5 Returning a Subroutine from a Subroutine;
7.6 Closure Variables as Inputs;
7.7 Closure Variables as Static Local Variables;
7.8 Finding Out Who We Are;
7.9 Exercise;
Chapter 8: Filehandle References;
8.1 The Old Way;
8.2 The Improved Way;
8.3 Filehandles to Strings;
8.4 Collections of Filehandles;
8.5 IO::Handle and Friends;
8.6 Directory Handles;
8.7 Exercises;
Chapter 9: Regular Expression References;
9.1 Before Regular Expression References;
9.2 Precompiled Patterns;
9.3 Regexes as Scalars;
9.4 Build Up Regular Expressions;
9.5 Regex-Creating Modules;
9.6 Exercises;
Chapter 10: Practical Reference Tricks;
10.1 Fancier Sorting;
10.2 Sorting with Indices;
10.3 Sorting Efficiently;
10.4 The Schwartzian Transform;
10.5 Multilevel Sort with the Schwartzian Transform;
10.6 Recursively Defined Data;
10.7 Building Recursively Defined Data;
10.8 Displaying Recursively Defined Data;
10.9 Avoiding Recursion;
10.10 Exercises;
Chapter 11: Building Larger Programs;
11.1 The Cure for the Common Code;
11.2 Inserting Code with eval;
11.3 Using do;
11.4 Using require;
11.5 The Problem of Namespace Collisions;
11.6 Packages as Namespace Separators;
11.7 Scope of a Package Directive;
11.8 Packages and Lexicals;
11.9 Package Blocks;
11.10 Exercises;
Chapter 12: Creating Your Own Perl Distribution;
12.1 Perl’s Two Build Systems;
12.2 Our First Distribution;
12.3 Inside Your Perl Distribution;
12.4 Inside a Module;
12.5 Plain Ol’ Documentation;
12.6 The Module Code;
12.7 Module Building Summary;
12.8 Exercises;
Chapter 13: Introduction to Objects;
13.1 If We Could Talk to the Animals. . .;
13.2 Introducing the Method Invocation Arrow;
13.3 The Extra Parameter of Method Invocation;
13.4 Calling a Second Method to Simplify Things;
13.5 A Few Notes About @ISA;
13.6 Overriding the Methods;
13.7 Starting the Search from a Different Place;
13.8 The SUPER Way of Doing Things;
13.9 What to Do with @_;
13.10 Where We Are;
13.11 Our Barnyard Summary;
13.12 Exercises;
Chapter 14: Introduction to Testing;
14.1 Why Should We Test?;
14.2 The Perl Testing Process;
14.3 The Art of Testing;
14.4 The Test Harness;
14.5 The Standard Tests;
14.6 Adding Our First Tests;
14.7 Measuring Our Test Coverage;
14.8 Exercises;
Chapter 15: Objects with Data;
15.1 A Horse Is a Horse, of Course of Course—Or Is It?;
15.2 Invoking an Instance Method;
15.3 Accessing the Instance Data;
15.4 How to Build a Horse;
15.5 Inheriting the Constructor;
15.6 Making a Method Work with Either Classes or Instances;
15.7 Adding Parameters to a Method;
15.8 More Interesting Instances;
15.9 A Horse of a Different Color;
15.10 Getting Our Deposit Back;
15.11 Don’t Look Inside the Box;
15.12 Faster Getters and Setters;
15.13 Getters that Double as Setters;
15.14 Restricting a Method to Class Only or Instance Only;
15.15 Exercise;
Chapter 16: Some Advanced Object Topics;
16.1 UNIVERSAL Methods;
16.2 Testing Our Objects for Good Behavior;
16.3 The Last Resort;
16.4 Using AUTOLOAD for Accessors;
16.5 Creating Getters and Setters More Easily;
16.6 Multiple Inheritance;
16.7 Exercises;
Chapter 17: Exporter;
17.1 What use Is Doing;
17.2 Importing with Exporter;
17.3 @EXPORT and @EXPORT_OK;
17.4 Grouping with %EXPORT_TAGS;
17.5 Custom Import Routines;
17.6 Exercises;
Chapter 18: Object Destruction;
18.1 Cleaning Up After Ourselves;
18.2 Nested Object Destruction;
18.3 Beating a Dead Horse;
18.4 Indirect Object Notation;
18.5 Additional Instance Variables in Subclasses;
18.6 Using Class Variables;
18.7 Weakening the Argument;
18.8 Exercise;
Chapter 19: Introduction to Moose;
19.1 Making Animals with Moose;
19.2 Improving the Race Horse;
19.3 Further Study;
19.4 Exercises;
Chapter 20: Advanced Testing;
20.1 Skipping Tests;
20.2 Testing Object-Oriented Features;
20.3 Grouping Tests;
20.4 Testing Large Strings;
20.5 Testing Files;
20.6 Testing STDOUT or STDERR;
20.7 Using Mock Objects;
20.8 Writing Our Own Test::* Modules;
20.9 Exercises;
Chapter 21: Contributing to CPAN;
21.1 The Comprehensive Perl Archive Network;
21.2 Getting Prepared;
21.3 How PAUSE Works;
21.4 Before We Start Work;
21.5 Preparing the Distribution;
21.6 Uploading the Distribution;
21.7 Testing on Multiple Platforms;
21.8 Announcing the Module;
21.9 Exercises;
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;

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews

Intermediate Perl 5 out of 5 based on 0 ratings. 1 reviews.
Guest More than 1 year ago
If you've been using Perl for more than a year and you find yourself dealing with increasingly complex data structures, you probably need to get and read this book. It lays out tricks and techniques for storing, manipulating and using deeply layered hashes, arrays, anonymous entities and even references to subroutines. This book is clearly written, full of excellent and illuminating examples, peppered with exercises (and illustrations of possible answers to same) and even amusing now and then. There are a few errors to be found, but errata lists are available from the O'Reilly website so you can be edit them out yourself before you even read it. I review a chapter of this book weekly, and it has dramatically improved my productivity as a Perl programmer. As the title of this review says, this book is indispensable.