Modern Perl 4th Edition is out, ebook version is free

来源:互联网 时间:2015-12-10

About This Title

When you have to solve a problem now, reach for Perl. When you have to solve a problem right, reach for Modern Perl . Discover how to scale your skills from one-liners to asynchronous Unicode-aware web services and everything in between.

Modern Perl will take you from novice to proficient Perl hacker. You’ll see which features of modern Perl will make you more productive, and which features of this well-loved language are best left in the past. Along the way, you’ll take advantage of Perl to write well-tested, clear, maintainable code that evolves with you. Learn how the language works, how to take advantage of the CPAN ’s immense trove of time-tested solutions, and how to write clear, concise, powerful code that runs everywhere. Specific coverage explains how to use Moose, how to write testable code, and how to deploy and maintain real-world Perl applications.

This new edition covers the new features of Perl 5.20 and Perl 5.22, including all the new operators, standard library changes, bug and security fixes, and productivity enhancements. It gives you what you need to use the most up-to-date Perl most effectively, all day, every day.

(Cartoon courtesy of: )

Five Things Perl (Still) Gets Right

by chromatic

In the late ’90s, I switched from Java to Perl because Perl made things easier. Perl let me get things done. Almost 20 years later, Perl still has a special place in my toolbox. I keep using it for certain projects because it still does some things so very well.

I can get many of these features from a lot of languages and platforms, and that’s great. Yet the combination available from Perl and its ecosystem keeps me coming back to the language.

CompatibilityThe first serious program I wrote in Perl was a statistical analysis of random number sequences. It was last modified on February 26, 2003 and still runs, untouched. This program isn’t unique in its longevity. Most programs written to run even for Perl 3 or 4 will run today on Perl 5.22. In the 8 major and 38 minor stable releases of Perl since 2000, nearly any program written will run without modification. The expectation of compatibility guides people to keep existing code working.

QualityPerl has a standard test suite that’s expected to pass on every platform with every commit. It has monthly unstable releases so that intrepid volunteer testers can test the CPAN – Perl’s large library of freely reusable third-party code – against the latest development versions.

A project called “Bleadperl Breaks CPAN ” bisect commits to Perl itself to find out exactly which change breaks which modules when something goes wrong. In practice, it’s possible to update an application to run on the newest release of Perl the day it’s released with no changes to your code. Just install the new version, install your module dependencies, and go.

UsabilityWriting documentation as a programmer is like flossing: everyone knows they should do it, but most of us don’t do it often enough. Yet Perl’s documentation standard has set a bar that few other projects I’ve seen have ever matched. Perl set this standard early; it includes voluminous documentation of the language, core libraries, and even its expected documentation format. CPAN modules have a well-established standard for documentation, including running code you can often copy and paste and modify into your own programs.

ScalabilityOne of Larry Wall’s early design goals was to fill the gap between one-off shell scripts and serious programs written in C. I like to think he took the ease of prototyping and low ceremony of shell scripting and combined it with the full power of Unix available from C.

If you plotted the sizes of all the programs I’ve written in the past couple of decades, you’d see a wide range: lots of one-liners, countless Unix filter scripts, and larger programs of tens of thousands or hundreds of thousands of lines. That’s not by accident; scalability of programmer effort is a deliberate goal of Perl that’s pervasive through much of the CPAN as well.

AvailabilityPerl’s been available on every professional system I’ve used in recent memory. It was quicker and easier to write a simple log parser in Perl on a new work laptop than to make sure I had all the development dependencies installed to install the correct other language dependencies to use the libraries I’d need there. (Though to be fair, I’m really good at writing simple log parsers after decades of Unix experience.)

Going from “I have a fresh account on a new machine” to “I can use Spreadsheet::WriteExcel to fill in the gaps of an existing spreadsheet just uploaded by a user” is easy—in part because I know all the pieces, but in part because I have confidence that they’re stable, well-tested, work together, and are available not just on my new laptop but on my server. I appreciate that Perl works and continues to work.

You Might Also Like What You Need

Perl 5.16 or newer (Perl 5.20 or 5.22 preferred). Installation/upgrade instructions included.

Resources Errata Releases Contents & Extracts Preface Running Modern Perl Credits The Perl Philosophy Perldoc Expressivity Context Implicit Ideas Perl and Its Community The CPAN Community Sites Development Sites Events IRC The Perl Language Names Variables Values Control Flow Scalars Arrays Hashes Coercion Packages References Nested Data Structures Operators Operator Characteristics Operator Types Functions Declaring Functions Invoking Functions Function Parameters Functions and Namespaces Reporting Errors Advanced Functions Pitfalls and Misfeatures Scope Anonymous Functions Closures State versus Closures State versus Pseudo-State Attributes AUTOLOAD Regular Expressions and Matching Literals The qr// Operator and Regex Combinations Quantifiers Greediness Regex Anchors Metacharacters Character Classes Capturing Grouping and Alternation Other Escape Sequences Assertions Regex Modifiers Smart Matching Objects Moose Blessed References Reflection Advanced OO Perl Style and Efficacy excerpt Writing Maintainable Perl Writing Idiomatic Perl Writing Effective Perl Exceptions Pragmas Managing Real Programs Testing Handling Warnings Files Modules Distributions The UNIVERSAL Package Code Generation Overloading Taint Perl Beyond Syntax Idioms Global Variables What to Avoid Barewords Indirect Objects Prototypes Method-Function Equivalence Automatic Dereferencing Tie Next Steps with Perl Useful Core Modules What’s Next? Brought to You By

Since 1998, chromatic has helped kick off the Perl testing revolution; contributed to the PerlMonks community from its origins; and wrote, edited, and reviewed many books and articles. He’s contributed to Perl’s current release structure, as well as Moose, Catalyst, Mojolicious, and p5p. He first released Modern Perl to the community in 2010.