#!/usr/local/ug/bin/perl5.003 #new perl engine is on owl (above) #old perl engine is on chico (below) #/users/research/students/chow/perl5/bin/perl ####################################################################### # file: ~lstein/public_html/cgi-bin/NetRes.pl # date: 4/10/96 # original: plot.pl 4/10/96 # purpose: generates a graphical plot of network data from files # # revision: created from plot.pl 9/3/96 for grad project # cleanup for release # # data flow: This program is called from the # ~lstein/NetRes/perl/NetRes.html form # After a person fills in what network and 2 nodes they # want and submit the form, this program is called # This program # 1. creates a web page for results of this program via # print statements you will find in this program # 2. reads two input data files under network directory # ./$net(nj or us)/rreact/$node1.$node2.cutl # ./$net(nj or us)/twoprong/$node1.$node2.cutl # 3. writes to 5 output files in ./plotdemo directory # ./plotdemo/$rreact_data # ./plotdemo/$twoprong_data # ./plotdemo/$gnuplot_cmd); # ./plotdemo/netres.ppm # ./plotdemo/netres.gif # 4. runs gnuplot program passing gnuplot_cmd file # 5. runs the ppmtogif program passing netres.ppm file # and redirecting output to netnres.gif # 6. exit program which returns web page generated on fly # showing graph generated by this program # ####################################################################### use CGI; # will use perl object library # extract params from web page environment passing $query = new CGI; # create a new query object $net = $query->param(net); # extract $net value from web page arguement $node1 = $query->param(node1); # extract $node1 value from web page $node2 = $query->param(node2); # extract $node2 value from web page # define the algorithms we want to do @algorithm = ("rreact","twoprong"); #define array with both alg names # start the web page print "Content-type: text/html\n\n"; print "
\n"; exit; } elsif ($node2 gt "N10") { print "
\n"; exit; } # end elsif } # end if $net eq nj # for the gnuplot program we have 3 files, 2 data files and a # command file (which is the instructions to gnuplot) # here we define the name of our data files $rreact_data = "plotdemo/rreact_data"; $twoprong_data = "plotdemo/twoprong_data"; $gnuplot_cmd = "plotdemo/gnuplot_cmd"; # remove any old data & command files lying around # note the command file name is a literal system("rm -f $rreact_data"); system("rm -f $twoprong_data"); system("rm -f $gnuplot_cmd"); system "rm -f plotdemo/netres.ppm"; # system "rm -f plotdemo/netres.gif"; # get rid of any old one open(GNUPLOTRREACT, "> $rreact_data"); # open data file for write open(GNUPLOTTWOPRONG, "> $twoprong_data"); # open data file open(GNUPLOTCMD, "> $gnuplot_cmd"); # open command file # we will start plotting from coords x=0,0 y=0,0 print GNUPLOTRREACT "0.0 0.0\n"; # start writing data print GNUPLOTTWOPRONG "0.0 0.0\n"; # start writing data # for each of the algorithm names (rreact & twoprong # do the following foreach $astring(@algorithm) { $algorithm = $astring; # extract this algorithm name # define where we will find the data file on disk $net_data_file = "$net/$algorithm/$node1-". $node2 . "cut.l"; # start body section of web page print "
net_data_file=$net_data_file