Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I want to use Chart::Gnuplot to plot a chart on the fly. The user will click on a link that will output the chart to screen.
At the moment I have the following relevant code defined:
my $chart = Chart::Gnuplot->new( output => "/home/dir/www/Plots/$node.$ran.$kpi.$interface.png" +, ....

The correct permissions are required (cgi user) to output to the directory. Any ideas on how to overcome the permission problem and output directly to the webpage instead of to a file?

Replies are listed 'Best First'.
Re: Chart::Gnuplot CGI
by Anonymous Monk on Mar 15, 2011 at 07:09 UTC
    output directly to the webpage instead of to a file?

    1) binmode STDOUT; 2 ) don't specify a filename, and the output will go directly to stdout, but it will be in postscript 3) if you want a different format, you will have to pipe to convert, this will require patching Chart::Gnuplot or something

Re: Chart::Gnuplot CGI
by Anonymous Monk on Mar 17, 2011 at 03:15 UTC
    Add the following line when you initiate the chart object:

    terminal => 'svg',

    and don't specify the filename. Then it will output the chart to STDOUT in SVG format. You can then embed the SVG code in the HTML file directly.