Parent Directory
|
Revision Log
modified use lib lines in cgi-scripts, scripts, courseScripts removed Global.pm updating and use lib line code from system_webwork_setup modified Global.pm to use webworkConfig (which is not in the repository!)
1 #!/usr/local/bin/webwork-perl 2 ############################################################ 3 # File: echo.pl 4 # Copyright: WeBWorK 1996 all rights reserved 5 # Description: Echos form data and environment variables if called as 6 # cgi script. If called with command line arguments it 7 # echos the command line and the environment variables. 8 ############################################################ 9 10 use CGI; 11 print "content-type: text/html\n\nHi"; 12 13 &CGI::ReadParse; 14 my %inputs = %in; 15 16 17 18 19 print <<end; 20 <HTML> 21 <HEAD> 22 <TITLE>ENV and ARGV variables</TITLE> 23 </HEAD> 24 <BODY> 25 <H1>ENV and ARGV variables</H1> 26 end 27 28 29 ##### Environment Variables ##### 30 31 print &hash2html("<h3>Environment Variables</h3>",%ENV); 32 33 ##### ARGV values (if any) ##### 34 35 print &array2html("<h3>Command Line Arguments</h3>", @ARGV); 36 37 38 ##### print STD ##### 39 print "<h3> Here is STD </h3>\n<PRE><CODE>"; 40 while (<STDIN>) { 41 print STDOUT; 42 } 43 print "</CODE>\n</PRE>\n"; 44 45 print qq!</BODY>\n</HTML>\n !; 46 47 # htmlFormat takes a variablename for the title and a hash as arguments 48 49 50 sub hash2html { 51 $title=shift(@_); 52 %hash=@_; 53 54 55 $out= "<DL>$title\n"; 56 57 @keys=keys(%hash); 58 foreach $key (sort @keys) 59 { 60 $out .= "\t<DT>$key</DT>\n"; 61 $out .= "\t\t<DD>$hash{$key}</DD>\n"; 62 } 63 64 $out .= "</DL>\n"; 65 } 66 sub array2html { 67 $title=shift(@_); 68 @array=@_; 69 $out="<p>\n$title\n<OL>\n"; 70 foreach $entry (@array) { 71 $out .= "\t<LI>$entry</LI>\n"; 72 } 73 $out .= "</OL>\n"; 74 } 75 76 77 78 79 80 81 82 sub getFormData { 83 $cgi=@_; 84 if ($commandLineInput) { 85 %out=("arguments",join(" ",@ARGV)) 86 } 87 else { 88 %out=$cgi->parse_form_data() ; 89 } 90 %out; 91 }
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |