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.
In reply to Re^5: perl inheritance
by chromatic
in thread perl inheritance
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |