From: Peter Rabbitson Date: Wed, 3 Jun 2009 22:05:05 +0000 (+0000) Subject: Graphviz does not like empty hahsrefs - prune those X-Git-Tag: v0.11008~164 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=349ec4b8c3ab1021dd59055a95ba22b2ec8704d6;p=dbsrgits%2FSQL-Translator.git Graphviz does not like empty hahsrefs - prune those --- diff --git a/lib/SQL/Translator/Producer/GraphViz.pm b/lib/SQL/Translator/Producer/GraphViz.pm index 764074e..17f51a6 100644 --- a/lib/SQL/Translator/Producer/GraphViz.pm +++ b/lib/SQL/Translator/Producer/GraphViz.pm @@ -245,10 +245,13 @@ sub produce { # translate legacy {node|edge|graph}attrs to just {node|edge|graph} for my $argtype (qw/node edge graph/) { my $old_arg = $argtype . 'attrs'; - $args->{$argtype} = { - map { %{ $_ || {} } } - ( delete $args->{$old_arg}, $args->{$argtype} ) - }; + + my %arglist = (map + { %{ $_ || {} } } + ( delete $args->{$old_arg}, delete $args->{$argtype} ) + ); + + $args->{$argtype} = \%arglist if keys %arglist; } # explode font settings @@ -341,7 +344,6 @@ sub produce { } } - # # Create a blank GraphViz object and see if we can produce the output type. #