sub test { my $object = shift; $object->somefunction if $object->can('somefunction'); }