I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2008-10-02 20:15:43-07 by pault
OIO incompatible with Test::MockObject

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?

Direct Responses: 8930 | 8943 | Write a response