From 39db27488e0e5157df81c2c9b67c89f184438868 Mon Sep 17 00:00:00 2001 From: doy Date: Sun, 14 Dec 2008 19:13:22 -0500 Subject: don't build the %pred hash if we aren't going to use it --- lib/Graph/Implicit.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Graph/Implicit.pm b/lib/Graph/Implicit.pm index 03b9ebb..50f7207 100644 --- a/lib/Graph/Implicit.pm +++ b/lib/Graph/Implicit.pm @@ -58,7 +58,7 @@ sub _traversal { my ($pred, $vertex) = @{ $remove->(\@bag) }; if (not exists $marked{$vertex}) { $code->($pred, $vertex); - $pred{$vertex} = $pred; + $pred{$vertex} = $pred if defined wantarray; $marked{$vertex} = 1; $insert->(\@bag, $_) for $self->neighbors($vertex); } -- cgit v1.2.3