sub use_object_somehow { my ($obj, $foo, $bar) = @_; carp "Object doesn't quack right" and return unless $obj->can("foo") and $obj->can("bar"); $obj->foo($foo); $obj->bar($bar); }