Begin main content

New Perl 5 OO Syntax [www.netalive.org]

This module (reformed-perl) providesw a whole bundle of OO syntax goodness for perl 5.

Personal favourites:

Sub args in definition (which is normally not possible in Perl due to lazy evaluation):

    sub method($foo, $bar)
    {
        print "First param: $foo";
        print "Second param: $bar";
    }
Implicit self, class and base:
    sub method
    {
        self->instance_method();
        class->static_method();
        base->super_class_method();
    }
Ability to override default setters (accessed by clients like a normal object hash value):
    fields foo;

    sub get_foo
    {
        print "Getting foo!";
        return self->{foo};
    }

    sub set_foo($value)
    {
        print "Setting foo!";
        self->{foo} = $value;
    }
Of course it's non-standard, but if it got adopted into, say, perl 5.9 then it could rock the Kazbah. Whatever that means.

11:25 PM, 29 Sep 2004 by Mark Aufflick Permalink

YAPOO

See Yet Another Perl OO module, Spiffy, here

by Mark Aufflick on 10/25/04

reformed Perl also on CPAN

It's still not moved from version 0.1, but reformed-perl is available on CPAN: http://search.cpan.org/~hkoch/reform-0.1/lib/reform.pm

by Mark Aufflick on 05/20/06

Add comment