kryberg has asked for the wisdom of the Perl Monks concerning the following question:
Now I want to do the process differently to more easily adjust the gnuplot set commands based on user input. I've been trying variations of the following code, but I'm getting either strange characters printed to the browser or currently the error "The server encountered an internal error and was unable to complete your request. Error message: Premature end of script headers: test6.pl"#!/usr/bin/perl -w # test.pl for testing real-time graph capabilities # November 9, 2004 use CGI qw( :standard ); use CGI::Carp 'fatalsToBrowser'; my $q = new CGI; my $station = $q->param('sta'); my $constituent = $q->param('const'); my $combined = "$station" . "$constituent"; my $img = `/usr/local/bin/gnuplot $station $constituent $combined`; print $q->header("image/png"), $img;
#!/usr/bin/perl -w # test6.pl for testing real-time graph capabilities # November 17, 2004 use CGI qw( :standard ); use CGI::Carp 'fatalsToBrowser'; #will print error message to user my $q = new CGI; open $station => "| /usr/local/bin/gnuplot" or die "$!\n"; print $station <<"--"; set terminal png color set output set xdata time set timefmt "%Y%m%d" set key left top title "Legend" box set grid xtics ytics set yrange [700:] set format x "%Y" set xlabel "Year" set ylabel "Sodium, water, filtered, milligrams per liter" set title "05056670 Western Stump Lake Major Ions" plot "05056670.txt" using 2:3 title "P00930 Sodium dissolved" -- print $q->header("image/png"),$station;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: gnuplot output to browser
by Joost (Canon) on Nov 17, 2004 at 19:55 UTC | |
by kryberg (Pilgrim) on Nov 17, 2004 at 20:33 UTC | |
by Joost (Canon) on Nov 17, 2004 at 21:38 UTC | |
|
Re: gnuplot output to browser
by traveler (Parson) on Nov 17, 2004 at 22:10 UTC |