Skip Menu |

This queue is for tickets about the DBIx-Class-Tree-NestedSet CPAN distribution.

Report information
The Basics
Id: 63346
Status: resolved
Priority: 0/
Queue: DBIx-Class-Tree-NestedSet

People
Owner: Nobody in particular
Requestors: moritz [...] faui2k3.org
Cc:
AdminCc:

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



Subject: Can't attach an independent root node
When I create two independent nodes (ie root nodes), and I try to attach one as the child of the other, I get the error message Cannot _attach_node to it's own descendant The attached patch fixes this.
Subject: root_check.patch
diff --git a/lib/DBIx/Class/Tree/NestedSet.pm b/lib/DBIx/Class/Tree/NestedSet.pm index 55411ac..37218e7 100755 --- a/lib/DBIx/Class/Tree/NestedSet.pm +++ b/lib/DBIx/Class/Tree/NestedSet.pm @@ -298,7 +298,7 @@ sub _attach_node { my ($root, $left, $right, $level) = $self->_get_columns; # $self cannot be a descendant of $node or $node itself - if ($self->$left >= $node->$left && $self->$right <= $node->$right) { + if ($self->$root == $node->$root && $self->$left >= $node->$left && $self->$right <= $node->$right) { croak("Cannot _attach_node to it's own descendant "); }
Fixed in github, it will be on cpan in version 0.09 Thank you Ian