Calling UNIVERSAL::can() as a function is allowed. (was: [OT] best way to determine existence of a function in a package)

Matt S Trout dbix-class at
Thu Nov 22 14:29:16 GMT 2007

On Wed, Nov 21, 2007 at 02:44:14PM -0800, chromatic wrote:
> On Wednesday 21 November 2007 14:15:09 Matt S Trout wrote:
> > You evidently didn't ask chromatic if he'd take a patch to make it possible
> > to ask Test::MockObject not to load those (with the current behaviour
> > staying as the default).
> >
> > I did. I'm pretty sure he said yes, although it was at a YAPC so I may have
> > been hallucinating while drunk.
> Which one are you again? <-- that one.

> > Of course, I never did get around to the patch. Anybody got any spare
> > tuits?
> I figured out the other day that the Right Approach was probably to warn only 
> if there's an overridden can/isa that Broken Code doesn't call.  I'm going to 
> make that the default behavior of UNIVERSAL::can and UNIVERSAL::isa very 
> shortly, perhaps even this afternoon.
> Then maybe hordes of CPAN developers will fix their bugs instead of blaming me 
> for trying to help people test their code.

That's basically why I want the option to turn them off - I want those bugs
to cause failures in my code, not warnings in my test suite that then become
failures at run time.

I also massively dislike having UNIVERSAL::can and ::isa in my dependency
chain; they have a tendency to scare people off for some reason and since I
get exactly zero value out of having them around I'd rather just not bother.

      Matt S Trout       Catalyst and DBIx::Class consulting and support -
   Technical Director
 Shadowcat Systems Ltd.  Christmas fun in collectable card game form -

More information about the mailing list