chromatic wrote: > On Tuesday 27 February 2007 00:13, Michael G Schwern wrote: > >> If that were so it would only warn when a MockObject is looked at using >> UNIVERSAL::isa/can() as a function. > > You really ought to read the code, especially the part where Test::MockObject > and UNIVERSAL::isa and UNIVERSAL::can are separate modules.
I have read the code, thank you. I've reported several bugs about them a few weeks ago. http://rt.cpan.org/Ticket/Display.html?id=24882 http://rt.cpan.org/Ticket/Display.html?id=24881 http://rt.cpan.org/Ticket/Display.html?id=24718 http://rt.cpan.org/Ticket/Display.html?id=24716 I've gotten no reply yet. [1] I realize this might be because rt.cpan.org does not appear to have been sending out ticket emails. > The previous paragraph is brought to you by the word "decoupled" and the > letters Q and A. Putting things in separate files does not necessarily mean they're decoupled. If module A has a universal behavior and is loaded by module B then the behavior of A is now coupled to B. You cannot load B without loading A and thus getting the universal behavior. You cannot load Test::MockObject without getting the behaviors of UNIVERSAL::isa and UNIVERSAL::can. They are coupled. Furthermore, their being separate modules does not bear relevance to the fact that MockObject can choose not to use UNIVERSAL::isa and instead write its own UNIVERSAL::isa function which only warns when a MockObject is used in a UNIVERSAL::isa() function. I posted proof-of-concept on rt.cpan.org. http://rt.cpan.org/Ticket/Display.html?id=24716 This handily solves your stated purpose of warning the user about MockObjects not being used because of UNIVERSAL::isa mistakes WITHOUT warning the user about EVERY mistaken use of UNIVERSAL::isa. [1] Now, if I was a smart ass I could say that since the bugs are not getting fixed I should now put warnings in my code to warn if they see those buggy modules loaded in order to force my user's attention on them and get them fixed. But I'm not a smart ass. :P