Subject: | peek method also breaks the object with r of n |
Date: | Mon, 7 May 2012 12:35:51 +1000 |
To: | bug-Algorithm-Permute [...] rt.cpan.org |
From: | Daniel Carosone <daniel.carosone [...] gmail.com> |
Just like bug id #45434
<https://rt.cpan.org/Ticket/Display.html?id=45434>for the reset
method, using peek also breaks the object.
Code:
use Algorithm::Permute;
my $p = new Algorithm::Permute(['a'..'d'], 2);
while ($p->peek) {
print join " ", $p->next, "\n";
}
print "###\n";
my $q = new Algorithm::Permute(['a'..'d'], 2);
while (my @l = $q->next) {
print join " ", @l, "\n";
}
output:
b a
a b
#####
b a
a b
c b
b c
c a
a c
d b
b d
d c
c d
d a
a d
Ubuntu 12.04, Algorithm::Permute 0.12
$ uname -a
Linux tramp2 3.2.0-24-generic #37-Ubuntu SMP Wed Apr 25 08:43:52 UTC 2012
i686 i686 i386 GNU/Linux
$ perl -v
This is perl 5, version 14, subversion 2 (v5.14.2) built for
i686-linux-gnu-thread-multi-64int
(with 53 registered patches, see perl -V for more detail)
--
Dan.