Hello wise monks. I've got problem using GraphViz within apache. In command line mode, this module works pretty well and I'm really happy with it. But as a cgi within apache, it's seems impossible to make it generate anything else than a 0 sized file :(

Found a solution!! : GraphViz needs a HOME environment variable. A SetEnv HOME /tmp/ (for instance) in apache conf fixed the problem. Actually it was written in the GraphViz FAQ about the same problem under debian.

Therefore, I deeply apologize for the time you worried about this problem.

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/L +inux Apache/2.0.40 perl v5.8.0 built for i386-linux-thread-multi 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.

-- Nice photos of naked perl sources here !


In reply to GraphViz , apache by jeteve

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.