Subject: | [PATCH] Fix use of uninitialized value |
The tiny patch attached moves the uninitialized value check to place
before the value is used.
Subject: | GraphViz-2.04-undef.patch |
Avoid warning about using an undefined value.
diff -up GraphViz-2.04/lib/GraphViz.pm.undef GraphViz-2.04/lib/GraphViz.pm
--- GraphViz-2.04/lib/GraphViz.pm.undef 2009-05-04 08:31:06.000000000 +0200
+++ GraphViz-2.04/lib/GraphViz.pm 2009-05-04 08:32:35.000000000 +0200
@@ -1239,12 +1239,12 @@ sub _attributes {
next if $key =~ /^(to|from|name|cluster|from_port|to_port)$/;
my $value = $thing->{$key};
+ $value = '' unless defined $value;
$value =~ s|"|\"|g;
$value = '"' . $value . '"'
unless ( $key eq 'label' && $value =~ /^<</ );
$value =~ s|\n|\\n|g;
- $value = '""' if not defined $value;
push @attributes, "$key=$value";
}