in reply to inheritance: constructors
For a clean and easy way to call parent initialisers "when appropriate", you might consider the use of NEXT. NEXT will call your parent's constructor if it exists and if it's appropriate. It will handle multiple inheritance without difficulty. It's also going to be a standard module in Perl 5.8.0.
You can find a whole chapter on NEXT and why it's useful in the Object Oriented Perl training notes from Perl Training Australia. TheDamian has also written an article on use.perl which can be found here.use NEXT; # ... sub _init { my $self = shift; $self->NEXT::UNSEEN::_init(@_); # My init goes here... }
Cheers,
Paul Fenwick
Perl Training Australia
|
|---|