package Foo; use strict; use warnings; my $_init_ = sub { my $self = shift; print STDERR ref($self) . "::_init_ called\n"; }; sub new { my $type = shift; my $class = ref($type) || $type; my $self = { attribute1 => undef, attribute2 => undef, }; bless $self,$class; $self->$_init_(); return $self; } 1; #### #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use lib "./"; use Foo; my $foo = new Foo(); print Dumper(\$foo),"\n"; #### package Bar; use strict; use warnings; use base qw( Foo ); 1; #### #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use lib "./"; use Bar; my $bar = new Bar(); print Dumper(\$bar),"\n";