in reply to Re^4: perl inheritance
in thread perl inheritance
Assuming your constructor, new, can create new objects when given the appropriate arguments:
package ReblessKids; use strict; use warnings; use Scalar::Util 'blessed'; sub do_something { my $self = shift; ... my $class = blessed $self; return $class->new( ... ); }
Update: I did mean blessed, not reftype.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: perl inheritance
by Anonymous Monk on Mar 29, 2012 at 15:39 UTC | |
by tangent (Parson) on Mar 29, 2012 at 16:11 UTC | |
|
Re^6: perl inheritance
by Anonymous Monk on Mar 29, 2012 at 14:43 UTC |