Etc. The idea is that your constructor is a wrapper on your parent's constructor, but you do additional things after that's called. So, the delta off your original code is that there is only one bless - in the ultimate parent's code. (You were doing a bunch of reblessing, which I think was confusing you.)package myParent; our @ISA; sub new { my $class = shift; bless $self,$class; $self->_parent_init(@_); return $self; } sub _parent_init { my $self = shift; print "_initParent (@_)\n"; } #---------------------------------- package myChild; our @ISA; use base qw(myParent); sub new { my $class = shift; my $self = $class->SUPER::new; $self->_child_init(@_); return $self; } sub _child_init { my $self = shift; print "_initChild (@_)\n"; }
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
In reply to Re2: maintaining constructor inheritance cascade
by dragonchild
in thread maintaining constructor inheritance cascade
by jaa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |