Skip Menu |
 

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

Report information
The Basics
Id: 49704
Status: resolved
Priority: 0/
Queue: UNIVERSAL-can

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

Bug Information
Severity: Normal
Broken in: 1.15
Fixed in: (no value)



Subject: (Query) Is UNIVERSAL::can generating spurious warnings for autobox.pm?
Download (untitled) / with headers
text/plain 515b
More a query than a bug per se... but might be a bug. The module autobox.pm (v2.55) has these lines at line 105, 106: *{"$class\::can"} = sub { shift; UNIVERSAL::can($class, @_) } \ unless (*{"$class\::can"}{CODE}); *{"$class\::isa"} = sub { shift; UNIVERSAL::isa($class, @_) } \ unless (*{"$class\::isa"}{CODE}); I raised a ticket against autobox (see RT #49273) but now I'm wondering if autobox is actually trying to do the right thing(?). Beyond my Perl I'm afraid.
Download (untitled) / with headers
text/plain 293b
Sorry -- should probably add the warning: Called UNIVERSAL::can() as a function, not a method at [...]/autobox.pm line 105 The warning for line 106 is similar but related to UNIVERSAL:isa: Called UNIVERSAL::isa() as a function, not a method at [...]/autobox.pm line 106
Download (untitled) / with headers
text/plain 996b
I think it's a combination of bugs. autobox ought to use the $class->can(@_) syntax, but the heuristic for detecting method calls in UNIVERSAL::can and UNIVERSAL::isa is sufficiently unreliable. autobox *could* work around this by naming the anonymous subs installed in the can() and isa() slots (local *__ANON__ = '...'; or one of the Devel:: modules), or it could specifically disable the warnings from U::c and U::i. The latter seems like a hack. The former... well, I could argue it's useful. It's a bit more invasive, but if chocolateboy finds it useful, it's my preference. The fragility of the heuristics in U::c and U::i bother me. Here's what I used to suppress the warnings. I didn't test it with the rest of the autobox suite: *{"$class\::can"} = sub { local *__ANON__ = 'can'; shift; $class->SUPER::can(@_) } unless (*{"$class\::can"}{CODE}); *{"$class\::isa"} = sub { local *__ANON__ = 'isa'; shift; $class->SUPER::isa(@_) } unless (*{"$class\::isa"}{CODE});
autobox 2.60 fixed this. Resolving.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.