November 2007 Archives

oreo on couch

| No Comments | No TrackBacks


| No Comments | No TrackBacks

OO Perl programmers often find them self typing this line many times:

    my $self = shift;

Why ? Because Perl do not have a special keyword to represent current object, the first argument in the argument list are taken to be the current object. Such convention has been there for years.

As Ingy döt Net tried to use source filter to sort that out, his Spiffy module is actually one of my favorite module. But there are too many know problem with source filter, and turned out nobody really enjoy it at all.

Although I've always think, with Perl, one shouldn't be bundled with the language to limit their thought, but should just enjoy the TIMTODI style to get things done in your favorite style. That's why the re-invented wheels like Template-Declare, Object-Declare, Scalar-Defer, Web-Scraper are so elegant.

Without using source filter, one can always say $_[0] to get the current object, but that's not very readable.

So provides a slightly different self, it's not a variable, but just a bare-word. Really it's function call that gets your current $_[0], but it's pretty handy.

Turned out somebody really likes it, that's great. :)

Labels: ,

A simple javascript log console...

| No Comments | No TrackBacks

With jquery, it's easy to create a PRE element on-the-fly and use that for showing debugging messages. Pretty much like using alert(), only less annoying.


    $(function() {
        $("<pre id='debug'></pre>").appendTo(document.body)
            position: 'absolute', bottom: 0, right: 0,
            background: 'red', color: '#fff'


    $("#debug").text("Some debugging message here...");

Labels: , ,