Skip Menu |

This queue is for tickets about the UNIVERSAL-can CPAN distribution.

Report information
The Basics
Id: 17566
Status: rejected
Priority: 0/
Queue: UNIVERSAL-can

People
Owner: Nobody in particular
Requestors: adamk [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.03
Fixed in: (no value)



Subject: Incompatible with any other magic
Sometimes, other modules most definitely DO need to call UNIVERSAL::can directly. Modules that are doing black magic, just as UNIVERSAL::can itself is doing black magic. Modules that specifically WANT to know whether something can do something, intentionally ignoring any overloading for various (mostly nefarious reasons) As an example, UNIVERSAL::isa needs to do similar black magic, and calls UNIVERSAL::can directly. Because it implements the change to a method call by force, UNIVERSAL::can prevents anybody from ever calling the ACTUAL UNIVERSAL::can and thus changes behaviour inside other magic modules (which it's often extremely important that things don't change). This is likely to (or at the very least creates potential for) UNIVERSAL::can intersecting with the functionality of other modules that do similar things to UNIVERSAL::can and having the combination explode or behavious quite incorrectly. Short of an attitude change, I really don't know how you can fix this problem. I also notice that warnings are now only optional! So instead of always pestering people and shutting up when warnings are off, we silently change the behaviour of Perl and don't want by default. (I'll file that as a seperate bug later) One solution might be to reverse the way things happen now. Always warn by default and don't do the magic behavioural change, unless an import param is provived. This would mean the absolute least amount of possible potential for collisions with other magic, while pestering people until the various bugs are fixed. As you are depending on 5.006 _anyway_ we won't see the very nasty problems that old 5.005/etc code might create. This would ALSO mean that in a mass testing environment, we could turn on -MUNIVERSAL::can and it would in effect act to turn on additional warnings without any risk that code is going to explode.
Subject: Re: [rt.cpan.org #17566] Incompatible with any other magic
Date: Fri, 10 Feb 2006 00:18:17 -0800
To: bug-UNIVERSAL-can [...] rt.cpan.org
From: chromatic <chromatic [...] wgz.org>
On Thursday 09 February 2006 23:16, via RT wrote: Show quoted text
> As an example, UNIVERSAL::isa needs to do similar black magic, and calls > UNIVERSAL::can directly.
Actually, that's a bug in UNIVERSAL::isa for which I've seen a test case as well as a patch, but I don't know if either is in RT yet. As for the rest, it does really go against the spirit of both modules -- they're there to allow things like Test::MockObject to work correctly. Perhaps a Perl::Critic plugin could search for the function invocation and perform the same purpose as the proposed warning. -- c
Global monkey punching is always fundamentally incompatible with other global monkey punching.