perl-achievements

August 18th, 2010
Perl

I already knew about git-achievements (and partake in the fun). But earlier this week Dean showed me Unit Testing Achievements.

My first thought after seeing it was: “cool, I want to port that to Smolder!“. My second thought was: “hey, if we can do it for Git, and for testing, why not for Perl itself?” Perl::Critic and Perl::Tidy already use PPI for their magic, surely it wouldn’t be too hard to harness its power for a little bit of fun?

And, indeed, it wasn’t:

[yanick@enkidu ~]$ cat foo.pl 
print "Hello world", $/;

[yanick@enkidu ~]$ alias perl="perl-achievements -r --"

[yanick@enkidu ~]$ perl foo.pl 
Congrats! You have unlocked 1 new achievement

************************************************************
*** Cryptomancer
*** Level 1

Used Perl magic variables.

Variables used: $/
************************************************************
Hello world

The code for this new Perl::Achievements is on Github. For now I was only aiming at churning out a prototype, so the code’s a mess, there’s no documentation whatsoever, and there are only two achievements to unlock. Buuut if I have time, and if it amuses peoples, it would be easy to make it grow into something a little more… interesting.