in reply to Extending parent object method?
Here's the problem:
my $class = ref($self) || $self;Within reset(), you're trying to get the class of the object. That'll be a string. The parent's reset() method wants an object invocant.
The good news is that you never have to write that ref($self) || $self. Delete it (even from your constructor) and this error should go away.
Your new() could be:
sub new { my $class = shift; my $self = $class->SUPER::new(@_); # do other stuff here for the child object... return $self; }
There's no need to rebless it, provided the parent constructor uses two-argument bless.
Improve your skills with Modern Perl: the free book.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extending parent object method?
by Syndaryl (Initiate) on Mar 12, 2012 at 13:51 UTC | |
by chromatic (Archbishop) on Mar 12, 2012 at 15:24 UTC |