Annotations, Attributes, Traits - Part II

This post is a continuation of Annotations, Attributes, Traits and explores the different options for applying metadata that are available to Perl, and what is needed to make these options available for third-party modules to use.

Posted in Perl 5 | Full Article and Comments

Annotations, Attributes, Traits

At last year's LPW, Stevan Little demonstrated a draft implementation of a new class system for Perl 5 (talk video can be found here). Here is how the proposed syntax works:

class Point {
    has $x ( is => 'rw' ) = 0;
    has $y ( is => 'rw' ) = 0;

    method clear {
        ($x, $y) = (0, 0);
    }
}

One of the questions that came up during the discussion afterwards was what is the best syntax for declaring the rich sets of additional metadata associated with class members and methods. This post is my take on the options that we have.

Posted in Perl 5 | Full Article and Comments

Catalyst::Model::FormFu

Catalyst::Model::FormFu has just hit CPAN. It is an experimental alternative interface to HTML::FormFu for Catalyst and its main puprpose is to provide improved performance over the existing Catalyst::Controller::HTML::FormFu. It parses the form configuration files and loads form objects during application startup, and then returns clones of these objects inside your actions. It is hard to evaluate precisely the performance boost that this provides (disk access speed will vary, and there is always the Catalyst overhead), but my crude benchmarks indicate that you can expect a form object to be loaded at least twice as fast when using Catalyst::Model::FormFu.

Posted in Modules | Full Article and Comments

Perl, Names and World Domination

Making a clean break from what draws you back is important. Whither can we go if "Perl 5" has lost its coolness factor, and "Perl 6" is already taken? But the path to world domination and greater numbers of "ninja perl programmers" and "perl rockstars" need not not necessarily go through the name of Perl itself. It did not for Ruby - it was Rails that did it. Here is my recipe:

Posted in Perl Evangelism | Full Article and Comments

My DarkPAN Setup

chromatic wrote about setting up a private CPAN to store your code. I am a big fan of this appropach, and I think that managing code as distributions, rather than as a bunch of stuff in a version control repo (which is the predominant practice in most shops), is the one and only way to go. Here is how we have set things up at $work:

Posted in Better CPAN | Full Article and Comments

MooseX::Params Usage Examples

MooseX::Params (my experiment in parameter processing) has undergone some changes and only the the attributes-based interface has been left now. Here are some examples from the synopsis of how it works. Most of them have been adapted from the Moose manual and the subroutines chapter of Gabor Szabo's Perl 6 tutorial.

Posted in Modules | Full Article and Comments