Skip Menu |

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

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

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

Bug Information
Severity: Important
Broken in: 1.12
Fixed in: (no value)



Subject: Thinks Class->can("foo") is a function call.
$ perl -MUNIVERSAL::can -wle 'Foo->can("bar")' Called UNIVERSAL::can() as a function, not a method at -e line 1 UNIVERSAL::isa does not have this problem. For some reason the check on line 46 is returning false. UNIVERSAL::can::can(/usr/local/lib/site_perl/UNIVERSAL/can.pm:46): 46: my $can = eval { $_[0]->$orig('can') || 0 }; DB<2> s UNIVERSAL::can::can(/usr/local/lib/site_perl/UNIVERSAL/can.pm:49): 49: goto &$orig if $can == \&UNIVERSAL::can; DB<2> x $_[0]->$orig("can") 0 undef
On Sun Feb 11 14:46:44 2007, MSCHWERN wrote: Show quoted text
> For some reason the check on line 46 is returning false. > > UNIVERSAL::can::can(/usr/local/lib/site_perl/UNIVERSAL/can.pm:46): > 46: my $can = eval { $_[0]->$orig('can') || 0 }; > > DB<2> s > UNIVERSAL::can::can(/usr/local/lib/site_perl/UNIVERSAL/can.pm:49): > 49: goto &$orig if $can == \&UNIVERSAL::can; > > DB<2> x $_[0]->$orig("can") > 0 undef
Ahh, here's the problem: $ perl -wle 'print Foo->can("can")' Use of uninitialized value in print at -e line 1. $ perl -wle 'package Foo; print Foo->can("can")' CODE(0x1801420) Which would seem to me to be a perl bug to work around.
From: chromatic [...] wgz.org
Show quoted text
> Ahh, here's the problem: > > $ perl -wle 'print Foo->can("can")' > Use of uninitialized value in print at -e line 1. > > $ perl -wle 'package Foo; print Foo->can("can")' > CODE(0x1801420) > > Which would seem to me to be a perl bug to work around.
I believe I've fixed this in 1.13_001; can you confirm?
Ah, this is the same bug as http://use.perl.org/~jk2addict/journal/34808 It's been annoying me for a while: $ perl -e 'use warnings; use UNIVERSAL::can; use DateTime;' Called UNIVERSAL::can() as a function, not a method at /home/acme/perl-5.10.0/lib/site_perl/5.10.0/DateTime/Locale.pm line 298 Installing UNIVERSAL-can-1.13_001.tar.gz does indeed fix the problem: $ perl -e 'use warnings; use UNIVERSAL::can; use DateTime;' Could you release this as a stable version? Cheers, Léon
Please could you release 1.13 as a stable version. I lost a fair amount of time tracking down a solution to my warning: Called UNIVERSAL::can() as a function, not a method at /usr/local/lib/perl/5.8.8/Template/Iterator.pm line 51 upgrading to 1.13 fixed it. I see that others are deliberately avoiding modules like Test::MockObject because UNIVERSAL::can produces these erroneous warnings: http://mailhub.ourshack.com/pipermail/templates/2007-June/009472.html
Fixed in 1.14.