in reply to Test::MockObject doesn't fool UNIVERSAL
The guide you refer to prefers UNIVERSAL::isa (etc.) over $obj->isa because $foo->method croaks when $foo is a reference that isn't an object. This has the cost of breaking anything that overrides the UNIVERSAL method.
I've started preferring always using the method call, wrapped in eval:
The only drawback that I see with this so far is that $@ is altered and would need to be localized if it's being otherwise used, such as in a DESTROY routine.if (eval { $obj->isa("Foo") }) { print "It's a foo!"; }
|
|---|