Monthly Archives: July 2010

Turn off Perl 5.12 deprecation warnings, if you dare!

Perl 5.12 deprecates several features, for various reasons. Some of the features were always stupid, some need to make way for future development, and some are just too ornery to maintain. All of these are listed in the perldelta5120 documentation. The new thing, however, is that Perl 5.12 will warn you about these even if [...]

Locate bugs with source control bisection

As you work in Perl you store each step in source control. When you finish a little bit of work, you commit your work. Ideally, every commit deals with one thing so you’re only introducing one logical change in each revision. Somewhere along the process, you might discover that something is not working correctly. You [...]

Perl Authors Night at Powell’s Technical Books

During OSCON, Joshua and I are taking part in the Perl Authors Night at Powell’s Technical Books on Tuesday, July 20 at 7 pm. Bring your copy of Effective Perl Programming for us to sign. Other authors confirmed so far include: chromatic (Modern Perl, Perl Testing: A Developer’s Notebook, Perl Hacks, Extreme Programming Pocket Guide) [...]

Keep your programmatic configuration DRY

A common mantra among programmers today is to keep your code DRY. This little acronym stands for “Don’t Repeat Yourself” and serves as a reminder that when you see a repetitive pattern in your code or are tempted to copy/paste some statements, you should think twice and consider extracting the common logic into a chunk of code that can be reused.

For many programmers, this practice begins to break down when “configuration” code is involved. When I talk about configuration code here, I’m not talking about the XML, YAML, INI, etc. bits of your project. I’m talking about the Perl code in your program that simply serves as data to feed some active portion of your code.

Set custom DBI error handlers

The DBI module lets you handle errors yourself if you don’t like its built-in behavior. DBI lets you handle the errors at either the database or the statement handle level by specifying attributes: my $dbh = DBI->connect( …, …, \%attr ); my $sth = $dbh->prepare( …, \%attr ); There are several attributes that affect error [...]

YAPC::NA 2010 Presentation Slides

At YAPC::NA 2010, brian gave a class on Effective Perl and I gave three short presentations related to topics that we discuss in Effective Perl Programming, 2nd Edition. Links to my presentations (with notes) in PDF format (gzipped) can be found below: Continuous Integration: CruiseControl and Perl Dependency Injection: Who Cares? Effective Perl: Unicode

Effective Perl Programming is in PDF and ePub

I just found out that Effective Perl Programming is available in digital formats through eBooks.com. They have a PDF version and an ePub version, each for $US31.99, which, sadly, is more than the hard-copy price of $US26.39 on Amazon.com and the Kindle price of $US17.59. They specifically list that these formats target Adobe Digital Editions, [...]

Watch out for side effects with `use VERSION`

To specify that you wanted to use at least a particular version of Perl, you specified that version with the use built-in: use VERSION; We covered this in Item 83: Limit your distributions to the right platforms, and we mentioned that it might invoke side effects. We didn’t get into the details in that Item [...]

The handful of basic Perl concepts

I’ve now given the second Effective Perl Programming class, this time a two-day master class at YAPC::NA 2010 in Columbus. The common comment during the class seemed to be “You just blew my mind again”. I’m also giving this talk in a one day format at YAPC::EU in Pisa on Aug 7 Most of the [...]