home *** CD-ROM | disk | FTP | other *** search
/ Internet Publisher's Toolbox 2.0 / Internet Publisher's Toolbox.iso / internet / website / args.pl_ / args.pl
Encoding:
Text File  |  1995-04-07  |  1.4 KB  |  50 lines

  1. #    =======
  2. #    args.pl
  3. #    =======
  4. #
  5. # Illustrate/test argument transfer
  6. #
  7. # Bob Denny    10-Feb-95
  8. #
  9. # WARNING TO perl PORTERS: NT perl inserts the '\r' on its own.
  10. # The output of scripts are read in BINARY mode by the server,
  11. # since the script may produce binary data. Therefore your 
  12. # Unix-flavor perl must be converted to use plain '\n' and
  13. # not '\r\n' for line endings.  SORRY!!!
  14. #
  15. # Edits:
  16. # 25-Feb-95  rbd  Fid argc, is #-1 in perl
  17. $CRLF = "\n";
  18. $method=$ENV{"REQUEST_METHOD"}; 
  19. print "Content-type: text/plain",$CRLF,$CRLF;
  20. print "CGI/1.2 (NT perl on Win95!, args.pl) report:",$CRLF;
  21. print "                 ^^^^^^^^^", $CRLF;
  22. if($#ARGV eq '-1') {
  23. print "No command args";
  24. } else {
  25. print "ARGC=",($#ARGV+1),", ARGV: ";
  26. for (@ARGV) { print; print " "; };
  27. }
  28. print $CRLF,$CRLF;
  29. print "Environment variables:",$CRLF;
  30. print "REQUEST_METHOD:  ",$method,$CRLF;
  31. print "SCRIPT_NAME:     ",$ENV{"SCRIPT_NAME"},$CRLF;
  32. print "QUERY_STRING:    ",$ENV{"QUERY_STRING"},$CRLF;
  33. print "PATH_INFO:       ",$ENV{"PATH_INFO"},$CRLF;
  34. print "PATH_TRANSLATED: ",$ENV{"PATH_TRANSLATED"},$CRLF;
  35. if($method eq "POST") {
  36. $cfile= $ENV{"CONTENT_FILE"};
  37. print "CONTENT_TYPE:    ",$ENV{"CONTENT_TYPE"},$CRLF;
  38. print "CONTENT_FILE:    ",$cfile,$CRLF;
  39. print "CONTENT_LENGTH:  ",$ENV{"CONTENT_LENGTH"},$CRLF;
  40. print "---- begin content ----",$CRLF;
  41. print while <STDIN>;
  42. print $CRLF,"----- end content -----",$CRLF;
  43. }
  44. print $CRLF,"end of report",$CRLF;
  45.  
  46.  
  47.  
  48.  
  49.