April 26, 2009 § Leave a comment
The Ironman comptetion has gone off to an impressive start, and the planet has been set up with all sorts of interesting posts coming in. So that’s one hello to Planet Ironman, and fellow bloggers! Secondly, I finally got my PAUSE account approved today, so I can finally start throwing some modules up onto CPAN – it feels nice to finally be able to give some things back to the Perl community.
I have a larger post coming up tomorrow about prototyping in Perl from some work I had to complete recently, but I just wanted to quickly milk this little bit of “fame” 😉
April 23, 2009 § 2 Comments
One of the most impressive features I see about Perl, is CPAN – the Comprehensive Perl Archive Network. For those unaware, this is a massive (and I mean massive) database of Perl modules that are all packaged up ready to be used in your project. Need email validation? Then go grab Email::Valid. Need database interaction? Go grab DBI and a relevant database driver. U need 2 haz lolcat in ur app? Acme::LOLCAT is there for you (as a joke :)) Just about anything imaginable is in the CPAN, and it’s tested and package up ready for your use.
It’s hard to describe just how rapid this can make application development. My Genius program that I’m working on now needs Gnome bindings (and specifically panel-applet bindings). I thought this would be a major roadblock for me, but no – there they are, right on CPAN: Gnome2 and Gnome2::PanelApplet – sweet! I needed a robust object management system, something flexible that I could prototype with, so I just grabbed KiokuDB (more on this awesomeness later).
However, while CPAN covers 99% of my needs, there are times when things don’t do quite what I want. We use Moose at MusicBrainz, and one of our attributes represents a bitmask – I had a look on CPAN before tackling this, but non of the modules really took my fancy. So I’ve written my own, and hopefully this will be my first CPAN contribution soon 🙂 Behold, MooseX::Bitmask (name subject to change, I expect).
This module provides an attribute metaclass and attribute traits for marking an attribute in Moose as a bitmask. It will automatically create some helper methods for you to check flags, and also another helper method to toggle a flag on and off. Here’s some example usage:
has 'flags' => (
isa => 'Int',
is => 'rw'
flags => [qw( shiney hard tasty )],
traits => [qw( Bitmask )],
Now, you can easily toggle attributes:
my $object = Foo->new;
Easy! I have some changes I want to add to this still, mostly support for renaming the provided methods (_has_flag and _toggle), and adding support for inspecting a bitmask in human form. But it’s really coming a long, and I look forward to getting this onto CPAN!
April 22, 2009 § Leave a comment
I’m a hopeless blogger, as anyone who’s subscribed to this blog can probably tell. But mst’s post raises some excellent points. Perl is a beatiful language, in my opinion. Yet constantly, it seems to get bad rep. People ask what I do for a job and I tell them I use Perl and they can’t help but smirk at that statement – and I’ve never got why.
So, if you don’t feel like meandering yourway through the linked wall of rant – the general gist of the movement is to get as many people blogging as possible, so I thought hey – might as well help. So a quick intro:
I’m a 2nd year student at Lancaster university student (comp sci, of course) and also work for MusicBrainz.org. Currently, MusicBrainz.org is going through a massive rewrite – new schema, and a new codebase. The latter I’ve been working on since Google Summer of Code 2008 and it makes ample use of Catalyst, Moose, Form::Processor and Template Toolkit, amongst other modules.
I’m also working on a few little pet projects at the moment too – one is a tool to help my revisions (read: slack off from revising). The idea is you feed the tool a set of questions and a set of answers, and it will periodically question you and record your progress. It’s proving to be an extremely fun project to work on – my first experience with App::Cmd and Gnome Perl bindings – but it’s all very smooth. Hopefully some more on this project a bit later! For now though, here’s how it looks: