Skip Menu |

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

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

People
Owner: GUIDO [...] cpan.org
Requestors: peter [...] makholm.net
Cc:
AdminCc:

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



Subject: Please localize $_
I got hit by using Data::Walk while $_ was aliased to an element of an array - thus mangling my array. To prevent this it would be nice if Data::Walk::walk() localized $_. This shouldn't change the documented interface. (File::Find documents $_ to be localized)
Hi, would the attached patch fix your problem? If not, can you send me a patch that works for you? Thanks, Guido
Index: lib/Data/Walk.pm =================================================================== RCS file: /home/cvsroot/perl/Data-Walk/lib/Data/Walk.pm,v retrieving revision 1.16 diff -u -r1.16 Walk.pm --- lib/Data/Walk.pm 24 Jun 2009 16:28:00 -0000 1.16 +++ lib/Data/Walk.pm 24 Jun 2009 16:31:31 -0000 @@ -139,6 +139,8 @@ } } + local $_ = $_; + unless ($options->{bydepth}) { $_ = $item; $options->{wanted}->($item);
This patch seems to fix the issue.
Fixed. [master 896a9bf] localize $_ 1 file changed, 2 insertions(+)