Skip Menu |
 

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

Report information
The Basics
Id: 42813
Status: rejected
Priority: 0/
Queue: Data-Visitor

People
Owner: Nobody in particular
Requestors: jasonk@cpan.org (no email address)
Cc:
AdminCc:

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



Subject: prototype mismatch warnings (w/patch)
Download (untitled) / with headers
text/plain 498b
Under 5.10, Data::Visitor gets a prototype mismatch warning due to the conflict between use Scalar::Util qw/blessed refaddr reftype weaken isweak/; and # currently broken has weaken => ( isa => "Bool", is => "rw", default => 0, ); This could also be the reason that it's currently broken, as someone noted in the source. A patch for one possible solution is attached, although you might prefer to simply rename the attribute... -- www.jasonkohles.com
Subject: Data-Visitor-weaken.patch
--- /usr/local/lib/perl5/site_perl/5.10.0/Data/Visitor.pm 2009-01-26 14:50:18.000000000 -0500 +++ Visitor.pm 2009-01-26 14:48:39.000000000 -0500 @@ -3,7 +3,7 @@ package Data::Visitor; use Squirrel; -use Scalar::Util qw/blessed refaddr reftype weaken isweak/; +use Scalar::Util qw/blessed refaddr reftype isweak/; # weaken use overload (); use Symbol (); @@ -423,7 +423,7 @@ foreach my $value ( Data::Alias::deref($new) ) { if ( ref $value and $targets{refaddr($value)}) { push @{ $seen_hash->{weakened} ||= [] }, $value; # keep a ref around - weaken($value); + Scalar::Util::weaken($value); } } }
I can't reproduce this, and I have no idea what could cause this. Yes, 'weaken' is imported from Scalar::Util. Yes, it does have a different prototype than the 'weaken' method Data::Visitor provides. However, the importing happens at compile time. After that, the rest of Data::Visitor gets compiled and all function calls to "weaken" get bound to the function imported from Scalar::Util. Then, at the end of compile time, namespace::clean starts doing its stuff, and removes every code symbol in the Data::Visitor package, which was there before the "use namespace::clean" invocation. That includes the 'weaken' from Scalar::Util. Now compilation is finished and we're at runtime. That executes the "has" statements, which will create accessors for all attributes, including 'weaken', but that won't cause a warning for mismatched prototypes, because at this point there's no weaken function in the current namespace. If you still get those warnings, they're probably caused by a misbehaving namespace::clean. In that case, I'd suggest reporting a bug there.
Download (untitled) / with headers
text/plain 226b
Sorry about that, turns out that I had at some point while trying to debug some namespace::clean issues, replaced namespace::clean with a no-op version and didn't realize it was still setup that way... -- www.jasonkohles.com


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.