Skip Menu |

This queue is for tickets about the Tree CPAN distribution.

Report information
The Basics
Id: 16889
Status: resolved
Priority: 0/
Queue: Tree

People
Owner: Nobody in particular
Requestors: raymond [...] print-quotes-software.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.00
Fixed in: (no value)



Subject: clone() fails for Tree::Binary
# $tree->clone() fails when using Tree::Binary # # Tested "Tree-1.00" on Perl 5.6.1, 5.8.3, and 5.8.7 (all Debian Sarge). # use strict; use warnings; use Data::Dumper; use Tree::Binary; my $tree = Tree::Binary->new('root'); $tree->left( Tree::Binary->new('child_l') ); $tree->right( Tree::Binary->new('child_r') ); print "Original: ", $tree->left->value, $/; # The clone trees value does NOT match the original. my $clone = $tree->clone; print "Clone: ", $clone->left->value, $/; # If you look at a dump of the two you'll notice each clone of a binary # tree has two more children per node. Meaning a tree cloned twice has # six children with the original values as the last two (Tree::Null for # the rest). As the accessor functions left/right look at index 0/1 # respectively the tree appears empty to the user. print $/, Dumper $clone->clone;
This has been fixed in 1.01.