ONLamp.com > Perl Articles
Perl Articles from www.perl.com
Beginner's Introduction to Perl 5.10, Part 2
Perl 5 has come a long way in the past few years. The newest version, Perl 5.10, added several new features to make your programs shorter, easier to maintain, easier to write, and more powerful. Here's how to start using files and strings in modern Perl.
A Beginner's Introduction to Perl 5.10
Perl 5 has come a long way in the past few years. The newest version, Perl 5.10, added several new features to make your programs shorter, easier to maintain, easier to write, and more powerful. Here's how to start using modern Perl productively.
Using Amazon S3 from Perl
Amazon's Simple Storage Service provides a simple, flexible, and inexpensive way to manage online data storage. Amazon's S3 modules for Perl make storing and retrieving data in your own programs almost trivial, leaving Amazon to worry about hosting, scaling, and backups. Abel Lin shows how to store, retrieve, and store data with Amazon S3.
Reverse Callback Templating
Many programmers know of the two main systems of templating. One embeds actual source code into the template. The other provides a mini language with loops, conditionals, and other control structures. There is a third way -- a reverse callback system. James Robson explains this best-of-both-worlds approach by demonstrating Perl's Template::Recall module.
Elements of Access Control
Some data is private. Other data, less so. Secure applications make it possible--and easy--to keep user data visible to the right people and invisible to the wrong people. Vladi Belperchinov explains how access control works and demonstrates with working code suitable for implementing your own access controls.
How to Tell Your Perl Story (at OSCON)
Have you done something stunningly cool or staggeringly useful with Perl in the past year? Conference season will be here soon; it's time to consider giving a talk to your local monger group, a regional conference, or even OSCON. Perl track committee member brian d foy gives several guidelines to help you decide what to talk about and how to present it.
Memories of 20 Years of Perl
The Perl community just celebrated the 20th anniversary of Perl. Here are some stories from Perl hackers around the world about problems they've solved and memories they've made with the venerable, powerful, and still vital language.
Programming is Hard, Let's Go Scripting...
Larry Wall's annual State of the Onion describes the state of Perl, the language and the community. In his 11th address, he discussed the past, present, and future of scripting languages, including the several dimensions of design decisions important to the development of Perl 6.
PDF Processing with Perl
Adobe's PDF is a well-established format for transferring pixel-perfect documents. It's not nearly as malleable as plain text, but several CPAN modules make creating, manipulating, and reusing PDFs much easier. Detlef Groth demonstrates how to use PDF::Reuse.
Making Perl Reusable with Modules
Perl programs are easy to write, especially if they solve simple problems. If you find yourself re-using the same programs (or worse, the same code), it's time to bundle your code into pieces easier to reuse. It's time to turn programs into modules. Andy Sylvester walks through the three steps of making a simple, standalone Perl program into a robust, tested, distributable, and reusable piece of code.
Option and Configuration Processing Made Easy
Many useful programs take arguments and configuration options. It's easy to add one or two, but as your program grows, the difficulty of allowing configuration concisely and intelligently also grows. Jon Allen demonstrates how to unify argument and configuration processing in a way that lets you write good code and your users get on with their work.
Better Code Through Destruction
Perl 5's reference counting scheme almost always keeps memory usage predictable...except for one corner case. The Resource Acquisition Is Initialization strategy helps avoid memory leaks--and can improve your use of exceptions, alarms, other resources, and even transactional systems. Igor Gariev demonstrates.
Everyday Perl 6
Perl 6 will soon be here, and to Perl 5 programmers it will feel very different yet very much the same. Perl 6 will enable programmers to be more expressive by giving them more tools to work with (making easy things easy) and allowing them to be more precise in their expressions. Jonathan Scott Duff demonstrates how everyday Perl tasks remain easy but become clearer and more powerful in Perl 6 code that you can run today.
Lightning Strikes Four Times
Perl lightning articles offer short takes on important subjects. See how Perl can outperform C for 3D programming, how (and why) to express cross-cutting concerns in your programs, and one way of keeping your test counts up-to-date.
The Beauty of Perl 6 Parameter Passing
Perl 6 isn't quite out yet, but you can learn and play with it today in various incarnations. One of the most compelling new features is a revamped and revised mechanism of parameter passing. Phil Crow demonstrates how powerful it is, and how you can gradually adopt more and more powerful constructs.
Advanced HTML::Template: Widgets
HTML::Template is a templating module for HTML made powerful by its simplicity. Its minimal set of operations enforces a strict separation between presentation and logic. However, sometimes that minimalism makes templates unwieldy. Philipp Janert demonstrates how to reuse templates smaller than an entire page--and how this simplifies your applications.
Painless Windows Module Installation with PPM
Unix and Unix-like systems often come with compilers and make utilities. Windows systems rarely do. Installing Perl modules on Windows can be somewhat difficult by hand. Fortunately, ActiveState's PPM utility takes away much of the pain, and it's highly customizable too. Josh Stroschein demonstrates how to install Perl modules with PPM and how to create your own repositories.
Using Java Classes in Perl
Java has a huge amount of standard libraries and APIs. Some of them don't have Perl equivalents yet. Fortunately, using Java classes from Perl is easy--with Inline::Java. Andrew Hanenkamp shows you how.
Advanced HTML::Template: Filters
HTML::Template is a templating module for HTML made powerful by its simplicity. Its minimal set of operations enforces a strict separation between presentation and logic. However, sometimes that minimalism makes templates unwieldy. Philipp Janert demonstrates how filters help you regain simplicity and separation of concerns.
Hash Crash Course
Most explanations of hashes use the metaphor of a dictionary. Most real-world code uses hashes for far different purposes. Simon Cozens explores some patterns of hashes for counting, uniqueness, caching, searching, set operations, and dispatching.
Rapid Website Development with CGI::Application
Perl has a wealth of good web frameworks. One of the season's toolkits, CGI::Application, has recently seen a bout of new development to make building web apps faster and much easier. Mark Stosberg demonstrates these new features and how to use them.
The State of the Onion 10
In Larry Wall's tenth annual State of the Onion address, he talks about raising children and programming languages and balancing competing tensions and irreconcilable desires.
Generating UML and Sequence Diagrams
Sometimes a picture can save you thousands of words of description--and debugging. A sequence diagram shows the flow of methods and function calls between modules. Perl lets you generate these almost automatically for Perl code--or even Java. Phil Crow shows how to use UML::Sequence.
Still More Perl Lightning Articles
Perl lightning articles are short, direct, and full of electrifying practical information. This time, Steven Philip Schubiger demonstrates how to convert crufty MakeMaker installation scripts into shiny pure-Perl installers, Phil Crow demonstrates the use of Java's powerful Swing UI toolkit from Perl, Joshua McAdams explains how to turn any module into a script, and chromatic removes duplication from test suites.
FEAR-less Site Scraping
Many web programmers talk about "domain-specific languages" as if defining functions and methods were a new discovery. A real domain-specific language provides concise syntax and symatics for a particular purpose, such as Yung-chung Lin's FEAR::API. He explains how this toolkit allows you to scrape, modify, store, and re-present web data easily, effectively, and economically.
Charting Data at the Bottom of the World
Alex Gough has a curious job. He's the only programmer for 500 miles at a remote Antarctic research station. His problems are like your problems too, though--gathering, manipulating, recording, and displaying data. Here's how he uses several CPAN modules to make pretty charts and graphs with almost no work.
Unraveling Code with the Debugger
Reading other people's code can be difficult, especially if you have no idea what happens when and where. Understanding code flow is vital to maintenance and bug fixes, but littering code with print and debugging statements is tedious and prone to error. There's another way: use the debugger! Daniel Allen demonstrates how to pinpoint a problem with Perl's debugger.
Using Ajax from Perl
The recently rediscovered Ajax technique makes the client side of web programming much more useful and pleasant. However, it also means revising your existing web applications to take advantage of this new power. Dominic Mitchell shows how to use CGI::Ajax to give your Perl applications access to this new power.
Advanced Subroutine Techniques
Subroutines seem like a basic building block of code. They're simple and easy to understand and use, right? That's true--but there are a few advanced techniques to make your code more maintainable and robust. Rob Kinyon goes beyond making sense of subroutines to making subroutines work for you.
Managing Rich Data Structures
Perl is so good at handling plain text files that it's seductively easy to use them when you need something better. Yet sometimes using a full-fledged database is just Too Much Work. If only Dave Baker had written an article on using complex, persistent data structures with MLDBM.
Debugging and Profiling mod_perl Applications
How do you use the debugger on a
mod_perl application? How do you profile an application embedded in a web server, with multiple child processes? Don't worry. Where there's Perl, there's a way. Frank Wiles demonstrates how to debug and profile
Test-Driving X11 GUIs
Is GUI testing as difficult as it seems? Maybe not, with the right testing libraries. George Nistorica shows what X11::GUITest can and can't do to make your Unix and Unix-like applications more robust.
More Advancements in Perl Programming
What's advanced Perl programming? The definition has changed over the years. For a while it was XS and GUIs and typeglobs and OO. Now a lot of it is using CPAN effectively. Since completing Advanced Perl Programming, Second Edition, Simon Cozens has discovered even more ways to work more smartly and effectively. Here's what he's learned.
Analyzing HTML with Perl
Kendrew Lau taught HTML development to business students. Grading web pages by hand was tedious--but Perl came to the rescue. Here's how Perl and HTML parsing modules helped make teaching fun again.
What Is Perl 6
Perl 6 is the long-awaited rewrite of the venerable Perl programming language. What's the status? What's changing? What's staying the same? Why does Perl need a rewrite anyway? chromatic attempts to answer all of these questions.
Lexing Your Data
Perl is famous for its text-processing capabilities. However, sometimes the data you want to process is too complicated for regular expressions and you reach for a parser for HTML, RTF, or other common format. What happens you don't have a pre-defined parser, but the text you need to work with is too complicated for regular expressions? Curtis Poe shows how to do proper lexing with Perl.
A Timely Start
A well-written Perl program should, in theory, beat a shell script, right? In theory. In practice, sometimes the details of your Perl installation have more to do with why your program is slow than you might believe. Jean-Louis Leroy recently tracked down a bottleneck and wrote up his experiences with making Perl programs start faster.
Logic Programming with Perl and Prolog
Perl isn't the last, best programming language you'll ever use for every task. (Perl itself is a C program, you know.) Sometimes other languages do things better. Take logic programming--Prolog handles relationships and rules amazingly well, if you take the time to learn it. Robert Pratte shows how to take advantage of this from Perl.
Testing Files and Test Modules
Perl hackers work with files all day long, creating, renaming, updating, editing, and munging them. Do you know your file-manipulation code works, though? That's why Phil Crow wrote Test::Files--to gain confidence and practice good coding. Here's how it works and how he tested a test module.
Perl Success Story: Client-Side Collection and Reporting
Perl's a great server-side programming language. It's also good for developers and administrators. Where are the client-side uses? Recently, Jiann Wang and Hitachi GST had to solve a thorny software licensing reporting problem. They used Perl--distributing a small client program to each desktop--and solved their problem quickly, effectively, and elegantly. Here's how.