in reply to inheritance: constructors
This'll execute a "private" method to initialise the correct variables for the object.$self->$_($params) for ( map{ $_->can("_init")||()} @ISA );
$self->{$_ns . $_} = $params->{$_} || '' for @manifest;
my $_ns = __PACKAGE__;For I find there are times when __PACKAGE__ doesn't want to play.
sub get_spong() { $_[0]->{ $_ns . 'spong' } }And because all of this is labour-intensive and boring,
As a rule of thumb Perl OO is tricky, because it's Perlish OO.
You can rewrite OO from first principals.
Perl OO can be clunky: it mirrors the developers understanding
of OO principals since Perl is so liberal.
--
Brother Frankus.
¤
|
---|