Or is it Test::MockObject? Or UNIVERSAL::can that's broken?
This is something that has been exercising my mind recently, and I've decided that it's Object::InsideOut. (Yeah, go on flame me!).
If you use both Test::MockObject and Object::InsideOut in your project, you'll find you get lots of 'UNIVERSAL::can called as function not as method' warnings.
These warnings are generated by UNIVERSAL::can, which is pulled in by Test::MockObject.
Object::InsideOut grabs a code ref to UNIVERSAL::can:
$GBL{'can'} = \&UNIVERSAL::can
and then calls it:
$code = $$GBL{'can'}->($thing, $method);
Naturally, a warning ensues. I've managed to suppress the warning using the modules in this order at the head of the script:
use Object::InsideOut ();
use UNIVERSAL::isa;
I just wish these two modules would play together nicely.
UNIVERSAL::can()
is a method. Calling methods as if they were functions does not work reliably. O::IO's use of the function reference is a bug.
If you're using Object::InsideOut, Test::MockObject, and UNIVERSAL::isa, you've just stepped into the middle of several vicious pedant wars (Google should turn up some goodies). I would suggest not using one or more of these modules.
Re:Yow!
TheNomad on 2008-10-01T09:27:41
Well, that's an easy decision. I'd stop using Object::InsideOut on the basis that inside-out objects are a fad.
The thing is to file a a bug report on OIO, but I can't straight away see how to fix the problem.
Re:Yow!
chromatic on 2008-10-01T17:48:06
After skimming the code, I wonder if OIO could stop monkeysquatting UNIVERSAL::isa and UNIVERSAL::can, perhaps by installing its own methods as methods in OIO-created classes (unless they already exist).
Despite being better than it was, UNIVERSAL::isa/can still aren't suitably complete.
Last time I checked, I think they still didn't support re-entrancy.
That is, if you have a custom ->isa that itself calls another ->isa, the second one doesn't work properly.
Re:Non-reentranty
chromatic on 2008-09-30T23:56:26
Last time I checked, I think they still didn't support re-entrancy.
I fixed those bugs per your test cases last year sometime. I'm sure I asked if you could reproduce any problems in the ticket.
With this reimplementation, OIO should now play well with Test::MockObject and the chromatic's CPAN versions of UNIVERSAL::can and UNIVERSAL::isa, and, hopefully, should eliminate the possibility of further conflicts of this nature.
Re:OIO 3.47 reimplements its -can() and -isa()
chromatic on 2008-10-08T00:11:11
I agree; the revised approach should never again conflict with T::MO. Good work.