in reply to How to differentiate hash reference and object reference?

Use blessed in Scalar::Util instead of testing for ref:
use strict; use warnings; use Scalar::Util 'blessed'; wants_foo_object({}); sub wants_foo_object { die "no object" unless defined(my $obj = shift); die "not an object" unless blessed($obj); die "not a foo" unless $obj->isa('foo'); }

Remember: There's always one more bug.