• I CAN HAS LOLCODE PARSER?

    Unless you've been buried in a bog for the last year, you'll have come across lolcats, the pictures of cats speaking an amusingly stilted dialect of English.

    From lolcats came lolgeeks and then, inevitably, lolcode:

    HAI
    I HAS A VAR ITZ 1
    IM IN YR LOOP
    VISIBLE VAR
    IZ VAR BIGGER THAN 39 O RLY?
    YA RLY
    GTFO
    NO WAI
    UP VAR!!1
    KTHX
    KTHX
    KTHXBYE
    

    I talked to Joe Drago, author of a lolcode interpreter written in Perl.  The parser is based on Parse::RecDescent, a recursive descent parser written by Damian Conway.

    Joe's a Senior Software Developer at a video game company, where most of his work is in other languages, but he says he prefers Perl to the C++ that pays the bills.

    Joe says, “I'd never used Parse::RecDescent before… I found it to be wonderful. I've been wanting to write a parser for a while now (I own the Dragon book and one on lex/yacc), but I needed a test case. This was a great opportunity to screw around with that. The module is very Perlish, in the sense that it lets you have fun with the grammar of a language without having to plan complex data structures too much to see some results. I highly recommend P::RD for Perl programmers interested in how grammars are written.”

    Unfortunately Joe's lolcode interpreter predates the official lolcode specifications and isn't compliant with them. But, he says, “I released it under the BSD license under the notion that someone more interested in the final standard would be inspired by my simple stuff and make something really cool with it. Hint, hint!”

  • Perl debugger reference card

    Andrew Ford, maintainer of refcards.com has released a reference card for the Perl debugger.

    refcard.png

    All his reference cards are downloadable as PDFs in the paper size of your choice.  His current reference card project is for WWW::Mechanize, which just tickles me.

  • White Camels for 2007

    The 2007 White Camel awards for achievements in promoting the Perl community have been awarded to Norbert E. Grüner, Allison Randal and Tim O'Reilly.

    The White Camel awards were started in 1999 to acknowledge the work of Perl's community leaders, and are awarded each year at the O'Reilly Open Source Conference.

  • Attributes: powerful Perl syntax you might not know

    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";
    }
    greet();
    

    ... prints "GOOD MORNING";

    You can also declare variables using attributes:

    my $greeting : Loud;
    

    To learn more about attributes and how to write them: