Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: draw a graph

by psini (Deacon)
on Jul 31, 2009 at 13:51 UTC ( [id://784903]=note: print w/replies, xml ) Need Help??


in reply to draw a graph

If the page returns with a server error (5xx) you should check the web server log to see what happened.

In this case, my best guess is that the server has not permissions to open graph.png for output; in general it is a bad idea using a relative path in a cgi script, for you really don't know which the current dir is at execution time. Try again, specifying an absolute patch name in your open, and a path in which the user running the web server has permission to write into.

Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."

Replies are listed 'Best First'.
Re^2: draw a graph
by AnomalousMonk (Archbishop) on Jul 31, 2009 at 15:10 UTC
    ... my best guess is that the server has not permissions to open graph.png for output ...
    It's also a good idea to let yourself know about such problems as they develop. Something along these lines might be informative:
    my $filename = 'graph.png'; open my $fh, '>', $filename or die "opening $filename: $!"; binmode $fh; print $fh $mygraph->plot(\@data)->png or die "writing $filename: $!"; close $fh or die "closing $filename: $!";
      Indeed ... even better would be to use CGI::Carp; to allow the errors &/or warnings to be seen by/in the browser, otherwise they'll only ever be seen in the server logs - but this may be a/the requirement.

      A user level that continues to overstate my experience :-))

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://784903]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-19 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found