Skip Menu |

This queue is for tickets about the Data-Visitor CPAN distribution.

Report information
The Basics
Id: 31390
Status: resolved
Priority: 0/
Queue: Data-Visitor

People
Owner: NUFFIN [...] cpan.org
Requestors: tokuhirom [...] gmail.com
Cc:
AdminCc:

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



Subject: Data::Visitor + UNIVERSAL::can = warnings
example code: ---- use strict; use warnings; use UNIVERSAL::can; use Data::Visitor::Callback; Data::Visitor::Callback->new( plain_value => sub { } )->visit(1); ---- result: Called UNIVERSAL::can() as a function, not a method at /.../lib//Data/Visitor/Callback.pm line 21
From: NUFFIN [...] cpan.org
Very strange, line 21 reads: my @class_callbacks = grep { $_->can("isa") } keys %callbacks; I'll ask chromatic On Tue Dec 11 21:24:21 2007, http://wassr.jp/user/tokuhirom wrote: Show quoted text
> example code: > ---- > use strict; > use warnings; > use UNIVERSAL::can; > use Data::Visitor::Callback; > > Data::Visitor::Callback->new( > plain_value => sub { } > )->visit(1); > ---- > > result: > Called UNIVERSAL::can() as a function, not a method > at /.../lib//Data/Visitor/Callback.pm line 21
RT-Send-CC: chromatic [...] wgz.org
Hi chromatic, It looks like UNIVERSAL::can is misdiagnosing this usage as wrong: my @class_callbacks = grep { $_->can("isa") } keys %callbacks; I haven't looked into why yet, and wondered if you might be aware of this issue
From: jrockway [...] cpan.org
On Tue Dec 25 18:23:55 2007, NUFFIN wrote: Show quoted text
> Hi chromatic, > > It looks like UNIVERSAL::can is misdiagnosing this usage as wrong: > > my @class_callbacks = grep { $_->can("isa") } keys %callbacks; > > I haven't looked into why yet, and wondered if you might be aware of > this issue
Looks like it warns when a non-loaded package is the invocant: $ perl -MUNIVERSAL::can -Mwarnings -e 'Foo->can("isa")' Called UNIVERSAL::can() as a function, not a method at -e line 1 Compare with: perl -MUNIVERSAL::can -Mwarnings -e 'eval "package Foo"; Foo->can("isa")' Which works fine. Regards, Jonathan Rockway -- Jonathan Rockway <jrockway@cpan.org>
OK, since chromatic isn't replying, this is resolved in the repo ( http://nothingmuch.woobling.org/browse_code?r=Data-Visitor ) FSVO resolved (i just disabled warnings in that particular scope). I don't like this "fix" because I think it's a bug in UNIVERSAL::can but honestly I don't care so much, I know my usage is valid in that case and it does work as expected regardless. I'll release a new version soon, I want to add a few other things to D::V first though... Should be up in a few days tops. Cheers