Subject: | I would have expected the peek method to work differently. |
Hi Robert,
For me the following command-line prints 5,4 while i would have expected it to print 4,4:
perl -MMooseX::Iterator -e 'my $iter = MooseX::Iterator::Array->new(collection =>
[4,5,6,7]); print $iter->peek(), ",", $iter->next(), "\n"';
The documentation says:
The next method provides the next item in the colletion.
The peek method returns the next item without moving the state of the iterator forward.
So they both return the value of the next item, so called in this order (first peek, then next),
shouldn't they return the same value?
Regards,
Lorenz