package Dog::Cocker; use strict; require Dog::Base; use vars '@ISA'; @ISA = 'Dog::Base'; my %cocker_attr = ( habits => 'barks at strangers', size => 'small', temperment => 'very loyal' ); sub new { my $class = shift; my $self = Dog::Base->new() unless ref $class; $self->{breed} = {%cocker_attr}; return bless($self, $class); } sub bark { my $self = shift; print "yarf\n"; } sub wag_tail { my $self = shift; print "tail wagging\n"; } 1; package Dog::CattleDog; use strict; require Dog::Base; use vars '@ISA'; @ISA = 'Dog::Base'; my %cattledog_attr = ( temperment => 'fiercley loyal', habits => 'leary of strangers', size => 'medium', ); sub new { my $class = shift; my $self = Dog::Base->new() unless ref $class; $self->{breed} = {%cattledog_attr}; return bless($self, $class); } sub bark { my $self = shift; print "shriek\n"; } sub wag_tail { my $self = shift; print "tail over back\n"; } 1;