sub display { my ($self,$args) = @_; # $args->{'my_code'} has our "custom code" # here is where we determine which one to use my $action = $args->{'my_code'} || $self->default_code; $action->($args); }