Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 127309
Status: new
Priority: 0/
Queue: Data-Dumper

People
Owner: Nobody in particular
Requestors: degatcpan [...] ntlworld.com
Cc:
AdminCc:

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



Subject: looping behaviour
Download (untitled) / with headers
text/plain 209b
running attached file gives infinite (?) loop. Comment out line starting 'print Dumper' to prevent loop. Data::Dumper v2.158 perl v5.22.1 Linux 4.4.0-137-generic #163-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
Subject: loop.pl
Download loop.pl
text/x-perl 736b
use strict; use warnings; use Data::Dumper; # v2.158 # perl v5.22.1 # Linux 4.4.0-137-generic #163-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux my $self = {}; my $cpook = {'b' => [0, 0]}; pair($self, 'a', 0, 0, $cpook); solve($self, ['a']); sub pair { my $self = shift; my $id = shift; my @ps = @_; _pair($self, $id, \@ps); } sub _pookpair { my ($self, $id, $aref) = @_; _pair($self, $id, $aref); } sub _pair { my ($self, $id, $aref) = @_; print Dumper $self->{pairs}; # comment this line to prevent loop $self->{pairs}->{$id} = $aref; } sub solve { my ($self, $treeref) = @_; my $pairid = $self->{pairs}->{$treeref->[0]}; while (my ($k, $v) = each %{$pairid->[2]}) { _pookpair($self, $k, \@$v); } }
Download (untitled) / with headers
text/plain 321b
On Sat Oct 06 06:33:25 2018, DEG wrote: Show quoted text
> running attached file gives infinite (?) loop. Comment out line > starting 'print Dumper' to prevent loop. > > Data::Dumper v2.158 > perl v5.22.1 > Linux 4.4.0-137-generic #163-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux
updated loop.pl; "while-each" loops, "for keys" behaves
Subject: loop.pl
Download loop.pl
text/x-perl 775b
use strict; use warnings; use Data::Dumper; # v2.158 # perl v5.22.1 # Linux 4.4.0-137-generic #163-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux my $self = {}; my $cpook = {'b' => [0, 0]}; _pair($self, 'a', [0, 0, $cpook]); solvewhile($self, ['a']); # comment this line to prevent loop solvefor($self, ['a']); sub _pair { my ($self, $id, $aref) = @_; print Dumper $self->{pairs}; $self->{pairs}->{$id} = $aref; } sub solvewhile { my ($self, $treeref) = @_; my $pairid = $self->{pairs}->{$treeref->[0]}; while (my ($k, $v) = each %{$pairid->[2]}) { _pair($self, $k, $v); } } sub solvefor { my ($self, $treeref) = @_; my $pairid = $self->{pairs}->{$treeref->[0]}; for my $k (keys %{$pairid->[2]}) { _pair($self, $k, $pairid->[2]->{$k}); } }


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.