#!/usr/local/bin/perl # # Simple Plot Demo program # # This plots a data file consisting of columns of X-Y coordinates # You can vary the color of the line and the style of the markers # # Larry Gales, 04-14-1999 # require 'cgi-lib.pl'; &ReadParse(*in); $gnuplot = "/usr/local/bin/gnuplot"; $color = $in{'color'}; SWITCH: { if ($color =~ "red") {$color = 1; last SWITCH;} if ($color =~ "blue") {$color = 3; last SWITCH;} if ($color =~ "green") {$color = 2; last SWITCH;} $color = 1; } $marker = $in{'marker'}; SWITCH: { if ($marker =~ "square") {$mark1 = 0; $mark2 = 4; last SWITCH;} if ($marker =~ "circle") {$mark1 = 0; $mark2 = 6; last SWITCH;} if ($marker =~ "triangle") {$mark1 = 0; $mark2 = 8; last SWITCH;} $mark1 = 3; $mark2 = 6; } $fname = $in{'datafile'}; if (! open(FILE,"<" . $fname )) { &file_Error( 500, " File Access Error, Cannot open file: $fname!"); } else { &run_gnuplot(); &convert_ps_to_jpg(); } # Create PS Gnuplot file ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sub run_gnuplot { open (GNUPLOT, "|$gnuplot"); print GNUPLOT </dev/null"; system($cmmd); } # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv # Object if a file is not there ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ sub file_Error { local ($errorN, $errorMsg) = @_; print "Content-type: text/html", "\n\n"; print "ERROR: $errorN $errorMsg \n"; } # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv