package Cow; use base qw(Animal); __PACKAGE__->makes_sound_like('moo'); ... #### package Animal; sub makes_sound_like { my $class = shift; my $sound = shift; our %sound_registry; if (exists $sound_registry{$sound}) { croak "two animals want the sound $sound\n"; } else { $sound_registry{$sound} = $class; } }