Subject: | List disappears with cloned head |
Date: | Sat, 01 Aug 2020 14:11:52 +0000 |
To: | bug-LinkedList-Single [...] rt.cpan.org |
From: | Jörg Sommrey <jo [...] sommrey.de> |
Hi,
there is a strange behaviour in LinkedList::Simple when a cloned list
head gets out of scope or is set to 'undef':
the original list disappears after a reset-to-start:
#!/usr/bin/perl
use strict;
use warnings;
use LinkedList::Single;
use Data::Dump 'pp';
my $lh = LinkedList::Single->new(1, 2, 3);
{
# When $lh_clone gets out of scope (or is set to undef),
# the original list disappears after reset-to-start.
my $lh_clone = $lh->clone;
;
}
pp $lh;
$lh->head;
pp $lh;
__DATA__
bless(do{\(my $o = [[[[], 3], 2], 1])}, "LinkedList::Single")
bless(do{\(my $o = undef)}, "LinkedList::Single")