From: Tara L Andrews Date: Wed, 18 Apr 2012 18:17:29 +0000 (+0200) Subject: suppress undefined warnings in cycle death X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7ec89b0e74bb39fb18fc259c37888306d3811a5e;p=scpubgit%2Fstemmatology.git suppress undefined warnings in cycle death --- diff --git a/lib/Text/Tradition/Collation.pm b/lib/Text/Tradition/Collation.pm index 5e38422..4c410c1 100644 --- a/lib/Text/Tradition/Collation.pm +++ b/lib/Text/Tradition/Collation.pm @@ -1493,8 +1493,8 @@ sub calculate_ranks { $r->rank( $node_ranks->{$rel_containers{$r->id}} ); } else { # Die. Find the last rank we calculated. - my @all_defined = sort { $node_ranks->{$rel_containers{$a->id}} - <=> $node_ranks->{$rel_containers{$b->id}} } + my @all_defined = sort { ( $node_ranks->{$rel_containers{$a->id}}||-1 ) + <=> ( $node_ranks->{$rel_containers{$b->id}}||-1 ) } $self->readings; my $last = pop @all_defined; throw( "Ranks not calculated after $last - do you have a cycle in the graph?" );