#!/usr/bin/perl -w print "Content-type: text/html\n\n"; use POSIX qw(strftime); require "cgi-lib.pl"; #use Shell (date) ; print " \n"; &ReadParse; # REPLACE COMMAS WITH SPACES IN Z INPUT # ALSO replace double space with single ($zvals = $in{'z'} ) =~ s/\,/ /g; ($zvals = $zvals ) =~ s/ / /g; # REPLACE E's and e's in in{'Lum'} for testing later ($fooLum= $in{'Lum'} ) =~ s/e/ /g; ($fooLum= $fooLum ) =~ s/E/ /g; # assign other variables $OM=$in{'OM'}; $OL=$in{'OL'}; $H0=$in{'H0'}; $Lum=$in{'Lum'}; ($Lum = $Lum ) =~ s/E/e/g; # MAKE SURE VALUES ARE NUMERIC ONLY OR DISALLOW if ($zvals =~ m/[a-zA-Z]/ || $in{'OM'} =~ m/[a-zA-Z]/ || $in{'OL'} =~ m/[a-zA-Z]/ || $in{'H0'} =~ m/[a-zA-Z]/ || $fooLum =~ m/[a-zA-Z]/ || $zvals =~ m/\-/ ) { print "All inputs must be positive real numbers (z<10) only!
"; print "Luminosity must be exponential notation of the form n.nE+nn or n.ne+nn
"; print " Try again
"; die; } # CHECK NUMBER OF ELEMENTS IN ARRAY @zarr=split / /, $zvals; $nz=scalar(@zarr); #print "Zarr is @zarr"; #print "Length is $nz
"; if ($nz >20 ) { print "Less than 20 z values please!
"; print " Try again
"; die; } # CHECK TO MAKE SURE NONE OF THE Z'S IS LARGER THAN 10 foreach $foo (@zarr) { if($foo > 10) { print "z values must be <10 please!
"; print " Try again
"; die; } } # call the external C PROGRAM AND PASS VARIABLES # first work all the params into 1 string #$params="$nz \r @zarr \r $omega,$H0,$lambda,$Lum " ; #print "Params= $params
"; # START THE REAL COMPUTATION PART system("rm cosmo.dat" ); system("./cosmo2 << end > cosmo.dat \r $nz \r @zarr \r $H0,$OM,$OL,0.0,$Lum \r end \r " ); $OK=1-$OM-$OL; $q0=$OM/2-$OL; # FORMAT OUTPUT print "

The cosmology you have chosen is:


" ; print " H0= $H0
"; print " OmegaMatter= $OM
"; print " OmegaLambda= $OL
"; print " Omegacurvature= $OK
"; print " q0= $q0
"; print " Intrinsic Luminosity of source= $Lum
"; # OPEN THE OUTPUT FILE AND READ IN LINES open (*STDIN, 'cosmo.dat'); print "
 ";
$i=0;
while ($_=) {
	if ($i > 5) {
		print "$_ ";
	}
	$i += 1;
}
print "
"; # TYPE OUTPUT print "
"; print "

New inputs?


"; print " \n"; exit(0);