Skip Menu |

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

Report information
The Basics
Id: 73065
Status: resolved
Priority: 0/
Queue: Data-Walk

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc: srezic [...] iconmobile.com
AdminCc:

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



Subject: Scalar::Util::refaddr instead of int()
I think it's better to use Scalar::Util::refaddr instead of $address = int $item; The latter can be wrong if a class overloaded 0+ or int. A sample script: #!perl use strict; use warnings; use Data::Walk; use bigint; my $obj = { a1 => 123, b1 => 456, }; walk { wanted => sub { warn $Data::Walk::address if defined $Data::Walk::address } }, $obj; __END__ Regards, Slaven
On 2011-12-07 05:29:23, SREZIC wrote: Show quoted text
> I think it's better to use Scalar::Util::refaddr instead of > > $address = int $item; > > The latter can be wrong if a class overloaded 0+ or int. >
And here's a sample how one can construct an (almost) endless loop without using the follow=>1 option: #!perl use strict; use warnings; use Data::Walk; { package Foo; use overload '0+' => sub { int rand 99999999 }; } my $foo = bless {}, 'Foo'; $foo->{recurse} = $foo; walk { wanted => sub { warn $_ } }, $foo; __END__ This cannot happen if Scalar::Util::refaddr is used in Data::Walk. Regards, Slaven
Fixed in git.