Skip Menu |

This queue is for tickets about the PadWalker CPAN distribution.

Report information
The Basics
Id: 112661
Status: rejected
Priority: 0/
Queue: PadWalker

People
Owner: robin [...] cpan.org
Requestors: jim.avera [...] gmail.com
Cc:
AdminCc:

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



Subject: Infinite loop if peek_my() called in conext of 'each'
The following loops, printing the same value over and over forever: #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use PadWalker; sub f($) { while (my ($vn, $vr) = each %{ PadWalker::peek_my(1) }) { print " $vn = ", Data::Dumper->Dump([$vr]); } } sub g { my $gvar = 123; f(shift); } g(2);
I don’t think this is a bug in PadWalker, but just a consequence of the way that each works. You get the same effect with a simple Perl sub that returns a hash ref, such as this: use strict; use warnings; sub f { return {1 => 2}; } while (my ($k, $v) = each %{ f() }) { print $k, $v; }
Subject: Re: [rt.cpan.org #112661] Infinite loop if peek_my() called in conext of 'each'
Date: Thu, 3 Mar 2016 11:32:06 -0800
To: bug-PadWalker [...] rt.cpan.org
From: Jim Avera <jim.avera [...] gmail.com>
Thanks, I didn't realize that. Please close this bug report. -Jim On 03/03/2016 02:25 AM, Robin Houston via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=112661 > > > I don’t think this is a bug in PadWalker, but just a consequence of the way that each works. You get the same effect with a simple Perl sub that returns a hash ref, such as this: > > use strict; use warnings; > sub f { > return {1 => 2}; > } > > while (my ($k, $v) = each %{ f() }) { > print $k, $v; > } >
Thanks. Will do. Robin On Thu Mar 03 14:32:18 2016, jim.avera@gmail.com wrote: Show quoted text
> Thanks, I didn't realize that. Please close this bug report. > -Jim > > On 03/03/2016 02:25 AM, Robin Houston via RT wrote:
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=112661 > > > > > I don’t think this is a bug in PadWalker, but just a consequence of > > the way that each works. You get the same effect with a simple Perl > > sub that returns a hash ref, such as this: > > > > use strict; use warnings; > > sub f { > > return {1 => 2}; > > } > > > > while (my ($k, $v) = each %{ f() }) { > > print $k, $v; > > } > >