Month: August 2007

Attributes: powerful Perl syntax you might not know

August 13, 2007 Uncategorized No comments

An anonymous monk at PerlMonks asks How is this Perl?.

sub end : ActionClass('RenderView') {}

As it turns out, they’re attributes, one of the newer and less well understood additions to Perl. You won’t see them everywhere, but they’re starting to appear in a number of places; many people — including the anonymous perlmonk — first encounter them in the Catalyst MVC framework.

Attributes allow you to add extra semantics to any Perl subroutine or variable. The typical example — given in both the perlmonks thread linked above, and in the Attribute::Handlers docs linked below, is an attribute :Loud which makes any subroutine called with it behave as if it only knew how to shout:

sub greet : Loud {
print "Good morning.n";

… prints “GOOD MORNING”;

You can also declare variables using attributes:

my $greeting : Loud;

To learn more about attributes and how to write them:

OSCON 2007 Perl lightning talks now online

August 10, 2007 Uncategorized No comments

Mike Schilli has put videos of some of the Perl lightning talks at OSCON up on YouTube.  Pudge sings his “Perl, In A Nutshell”, Julian Cash talks about his MoveMyData project, and Schwern talks about how to know how long five minutes is, and why this matters to projects.

Below: Chris “Pudge” Nandor performs “Perl in a Nutshell”.