package Thingy; sub cog_class { 'Thingy::Cog' } sub get_cog { my $self = shift; $self->cog_class->new(@_) } package MyThingy; use base Thingy; sub cog_class { 'MyThingy::Cog' } #### package MyThingy::Cog; sub get_ramp { my $self = shift; $self->thingy->ramp_class->new(@_) }