--- loncom/cgi/plot.gif 2001/12/20 22:36:15 1.5 +++ loncom/cgi/plot.gif 2001/12/21 14:43:50 1.6 @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# $Id: plot.gif,v 1.5 2001/12/20 22:36:15 matthew Exp $ +# $Id: plot.gif,v 1.6 2001/12/21 14:43:50 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -24,27 +24,21 @@ # # http://www.lon-capa.org/ # - use strict; -my $output; -my $tmpdir = '/home/httpd/perl/tmp/'; -my $filename = $tmpdir . $ENV{'QUERY_STRING'}; -$output =<<"END"; -Content-type: text/html +$|=1; +my $tmpdir = '/home/httpd/perl/tmp/'; +my $filename = $tmpdir . $ENV{'QUERY_STRING'}; -END - -if (0) { -$output =<<"END"; +if (-e $filename) { + open PLOT, "gnuplot $filename |"; + print <<"END"; Content-type: image/gif - END -$output .= `gnuplot $filename`; + while ($_=) { + print; + } } -print $output; - -