sub cando { my $o = shift; my $m = shift; return if !eval { $o->can($m) }; return $o->$m(@_); } my $home = cando($self, 'home') // cando($self, 'house', 1) // confess(q{Can't determine home});