package Utils;
sub new {
my $class = shift;
my $self = {};
# Bless into the appropriate class
my $obj = bless $self, $class;
$obj->init(@_);
return $obj;
}
sub init {
# does nothing
}
package Utils::MidLevel
@Utils::MidLevel::ISA = qw(Utils);
sub init {
my $self = shift;
my @args = @_;
$self->SUPER::init(@args);
# Now do initialization of object
}
package Utils::LowLevel
@Utils::LowLevel::ISA = qw(Utils::MidLevel);
sub init {
my $self = shift;
my @args = @_;
$self->SUPER::init(@args);
# Now do initialization of this class
}
####
my $object = new Utils::LowLevel();
####
my $object = new Utils();