Skip Menu |

This queue is for tickets about the GraphViz CPAN distribution.

Report information
The Basics
Id: 41765
Status: resolved
Priority: 0/
Queue: GraphViz

People
Owner: Nobody in particular
Requestors: Ian.Goodacre [...] xtra.co.nz
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.04
Fixed in: (no value)



Subject: Error: bad label format when quotes in label
The attached test script reproduces an error encountered when using GraphViz::DBI. It uses quotes in the label of a node which causes and error. Output of the attached script: Error: bad label format { digraph test { graph [ratio=fill]; node [label="\N"]; graph [bb="0,0,54,36"]; test [label="{", table=true, "|field1\lfield2\l}"=true, shape=record, pos="27,18", rects="0,0,54,36", width="0.75", height="0.50"]; } This can be fixed by the following patch: # diff -u GraphViz.pm.orig GraphViz.pm --- GraphViz.pm.orig 2008-12-17 10:14:34.000000000 +1300 +++ GraphViz.pm 2008-12-17 10:53:06.000000000 +1300 @@ -1239,7 +1239,7 @@ next if $key =~ /^(to|from|name|cluster|from_port|to_port)$/; my $value = $thing->{$key}; - $value =~ s|"|\"|g; + $value =~ s|"|\\"|g; $value = '"' . $value . '"' unless ( $key eq 'label' && $value =~ /^<</ ); $value =~ s|\n|\\n|g; With this patch applied, output of the test script is: digraph test { graph [ratio=fill]; node [label="\N"]; graph [bb="0,0,56,64"]; test [label="{\"table\"|field1\lfield2\l}", shape=record, pos="28,32", rects="0,40,56,64 0,0,56,40", width="0.78", height="0.89"]; }
Subject: test.pl
#!/usr/bin/perl use strict; use warnings; use GraphViz; my $g = GraphViz->new(); $g->add_node( name => "test", shape => 'record', label => '{"table"|field1\lfield2\l}', ); print $g->as_text;
From: Ian.Goodacre [...] xtra.co.nz
And here is a patch to t/simple.t that tests for (what appears to me to be) correct behaviour with quotes in labels. [root@alula t]# diff -u simple.t.orig simple.t --- simple.t.orig 2008-12-17 11:04:49.000000000 +1300 +++ simple.t 2008-12-17 11:08:51.000000000 +1300 @@ -4,7 +4,7 @@ use warnings; use lib '../lib', 'lib'; use GraphViz; -use Test::More tests => 30; +use Test::More tests => 31; my @lines = <DATA>; @@ -492,3 +492,15 @@ ratio="fill"; GOroot [label=<<FONT COLOR="red">root</FONT>>, shape="plaintext"]; } +-- test -- +$g = GraphViz->new(); +$g->add_node( + name => "test", + shape => 'record', + label => '{"table"|field1\lfield2\l}', +); +-- expect -- +digraph test { + ratio="fill"; + test [label="{\"table\"|field1\lfield2\l}", shape="record"]; +}
This issue is fixed in GraphViz2 V 1.00. There're won't be any further development on GraphViz.