Hello,
I guess not many people use both Test::MockObject and Object::InsideOut otherwise this problem would have been discussed before. And I guess the reason, is that Test::MockObject, without a tiny bit of tweaking, mocks only hash-based objects and not inside-out ones.
Never the less, if you have a project, especially a legacy project, that uses Object::InsideOut for some objects, but whose test suite uses Test::MockObject then you have a problem. The problem arises because Test::MockObject uses UNIVERSAL::can which includes a warning when &UNIVERSAL::can is called as a subroutine rather than a method.
OIO takes a reference to &UNIVERSAL::can and calls the reference at line 29 of Object::InsideOut::Universal. This results in an annoying warning. The warning is correct, because UNIVERSAL::can is a method, not a function and calling this coderef is a bug.
In a discussion on use.perl (http://use.perl.org/~TheNomad/journal/37579), chromatic suggests that a fix would be for OIO to subclass UNIVERSAL, say OIOUniversal, that can then call the superclass method when necessary without actually trying to rewrite &UNIVERSAL::can.
It appears to me this would work. Has anyone got any thoughts?
(2)
]
