North West Perl Hackathon

December 14, 2009 § Leave a comment

The hackathon took place over the weekend, and for me it was great fun! It’s my first time attending a Perl Mongers event (even though I’ve been meaning too for at least half a year, bah) and was really nice to put some faces to the names I see on IRC. For the hackathon, we were working on the IronMan project – 3 different parts in fact

The three projects were converting our CSV archives into database format, adding support for viewing the archives in the Catalyst application, and refactoring Perlanet so we can use it to aggregate feeds for the site itself. I was working on the later project. It was a fairly straightforward task, just refactoring someone elses work into something easier to subclass. It took about 6 hours to do, and I’m fairly happy with the result. The best bit is, it’s already been merged!

So, a sucess for me I think, and I look forward to seeing the results of everyone else. If you’re in the north-west, be sure to sign up to the mailing list, I believe there’s a curry being planned for mid January in Preston – and no one can say no to curry and beer, right?

Handy module of the day: aliased

December 6, 2009 § Leave a comment

A recent hacker on MusicBrainz showed me this module in a recent patch he submitted, and I’m baffled I hadn’t discovered it earlier!

aliased is a very simple module that allows you to alias long namespaces into a shorter one, or rename packages. This has a ton of uses, and here’s a very basic use:

class MyLibrary::SomePath::GodThisIsLong::Person {
    has name => ( is => 'rw' );

package MyApp;
use aliased 'MyLibrary::SomePath::GodThisIsLong::Person';
my $person = Person->new( name => 'Enlightened Developer' );

This alone enhances readability; in the cases where you are creating a lot of object, you remove a lot of the noise in your code.

You can be a bit more specific with your aliasing, and alias stuff into a new name. Here’s a very contrived example to demonstrate this too:

class MyLibrary::Person::V2 {
   has [qw( first_name surname )] => ( is => 'rw' )

package MyApp;
use aliased 'MyLibrary::Person::V2' => 'Person';

my $person = Person->new( first_name => 'Enlightened', surname => 'Hacker' );

Extremely simple module, but I love it already!

Where Am I?

You are currently viewing the archives for December, 2009 at Cycles.