# lib/Animal.pm package Animal; sub new { my $class = shift; return bless {}, $class; } sub is_furry { my $self = shift; warn "We don't know if this animal is furry or not!\n"; return undef; } sub make_noise { my ( $self, $noise ) = @_; print $noise, "\n"; } 1; # lib/Bear.pm package Bear; use base 'Animal'; # We know bears are furry, so override Animal's is_furry method: sub is_furry { my $self = shift; return 1; } sub eat_honey { my $self = shift; # Make use of Animal's make_noise method: $self->make_noise( "Yum!" ); } 1; # example.pl use Animal; use Bear; my $baloo = Bear->new; if ( $baloo->is_furry ) { $baloo->eat_honey; }