github.com/slspeek/camlistore_namedsearch@v0.0.0-20140519202248-ed6f70f7721a/website/test.cgi (about) 1 #!/usr/bin/perl 2 # 3 4 use strict; 5 print "Content-Type: text/html\n\n"; 6 7 print "<html><head><title>dump output</title></head><body>\n"; 8 9 if ($ENV{'REQUEST_METHOD'} eq "GET") { 10 my $in = $ENV{'QUERY_STRING'}; 11 print "<h2>REQUEST_METHOD was GET</h2><pre>\n"; 12 print "Stdin= [$in]\n"; 13 print "</pre>\n"; 14 } elsif ($ENV{'REQUEST_METHOD'} eq "POST") { 15 my $in; 16 sysread(STDIN, $in, $ENV{'CONTENT_LENGTH'}); 17 print "<h2>REQUEST_METHOD was POST</h2><pre>\n"; 18 print "Stdin= [$in]\n"; 19 print "</pre>\n"; 20 } 21 22 print "<h2>Environment variables</h2><pre>\n"; 23 foreach my $key (sort(keys(%ENV))){ 24 print "<B>$key</B>", " "x(23-length($key)), "= $ENV{$key}\n"; 25 } 26 27 print "</pre>\n"; 28 29 print "</body></html>\n"; 30 exit 0;