PERL   62

test cgi

Guest on 19th August 2022 04:38:14 PM

  1. #!/usr/bin/perl
  2. use CGI;
  3. $query = new CGI;
  4. @names = $query->param;
  5.  
  6. # print header
  7. print "Status: 200 Content follows\n";
  8. print "Content-type: text/html\n\n";
  9.  
  10. # print start  stuff
  11. print "Test script<BR>\n";
  12.  
  13. # print current working dir
  14. print "Current working directory:" . `/bin/pwd` . "<br>\n";
  15.  
  16. # print parameter count
  17. print "Number of all parameters:";
  18. print 1+$#names;
  19. print "<br>\n";
  20.  
  21. # print list of parameters
  22. print "Names/Values of all parameters:<br>\n";
  23. print "<pre>";
  24. for $p (@names) {
  25.         print "     $p=";
  26.         print "\"" . $query->param($p) . "\"\n";
  27. }
  28.  
  29. # print enviornment variables
  30. print "Evniornment Variables\n";
  31. for $p (keys %ENV) {
  32.         print "     $p=";
  33.         print "\"" . $ENV{$p} . "\"\n";
  34. }
  35. print "</pre>";

Raw Paste


Login or Register to edit or fork this paste. It's free.