Subject: | Please do not use UNIVERSAL::can and UNIVERSAL::isa |
My test suite suddenly started spewing out this...
Called UNIVERSAL::can() as a function, not a method at
/usr/lib/perl5/site_perl/5.8.0/Class/DBI.pm line 265
Which is true, but its a warning I'd never seen before. Oddly enough,
this was only showing up during testing. I couldn't reproduce that
warning in production. I couldn't get the warning with something like this:
perl -wle 'UNIVERSAL::can("foo", "bar");
Took me some time to track down where it was coming from... the
UNIVERSAL::can module called inside Test::MockObject!
UNIVERSAL::can and isa do not appear to be important to the
functionality of MockObject. I can stub them out and all the tests pass
fine.
MockObject is infecting my entire test suite with universal,
non-critical, annoying functionality. Its causing warnings in code not
under my direct control. While I understand the reasons why one should
not call UNIVERSAL::can and isa as functions, its not MockObject's job
to Spread The Good Word.