Subject: | graph viz does not work within apache |
My conf:
GraphViz 2.02
uname -a
Linux -- 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux
Apache/2.0.40
perl v5.8.0 built for i386-linux-thread-multi
When am using GraphViz from command line, it works perfectly, but within apache, it fails to fill the output file when it works as a cgi.
Here is my CGI:
#! /usr/bin/perl -w
use GraphViz;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
my $g = GraphViz->new( directed => 0 );
my $europe = {
name =>'Europe',
style =>'filled',
fillcolor =>'lightgray',
fontname =>'arial',
fontsize =>'12'
};
$g->add_node('London' , shape => 'hexagon' , URL => 'http://www.eteve.net/', cluster=> $europe );
$g->add_node('Paris', cluster => $europe );
$g->add_node('New York');
$g->add_node('LA', label => '' , style => 'invis' ,
height => 0 ,
width => 0 ,
shape => 'circle' ,
);
$g->add_node('Amsterdam', cluster => $europe);
$g->add_edge('London' => 'Paris');
$g->add_edge('London' => 'New York', label => 'Far');
$g->add_edge('Paris' => 'LA' , label => 'Very far');
$g->add_edge('LA', 'New York', label => 'Not so far');
$g->add_edge('Paris' => 'London' ,minlen => 0 , weight => 100 );
open IMG , ">/tmp/img.jpg";
binmode IMG ;
print IMG $g->as_jpeg;
close IMG ;
The problem is the image /tmp/img/jpeg is zero sized.
When the GraphViz code is ran from the command line, it works perfectly.