Guest User

Untitled

a guest
Jan 18th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #!/[localpath]/perlbrew/perls/perl-5.24.0/bin/perl -d
  2.  
  3. use strict;
  4. use warnings;
  5. use CGI;
  6.  
  7. my $q = CGI->new();
  8.  
  9. print "Content-type: text/htmlnn";
  10. print "<p>key = " . $q->param('myparam') . "</p>n"; #this is always empty
  11. my @names = $q->param;
  12. foreach my $name (@names) {
  13. print "<p>$name = " . $q->param($name) . "</p>"; #this never runs
  14. }
  15.  
  16. my $postdata = '';
  17. my $in = *STDIN;
  18. my $bytes = read($in, $postdata, $ENV{'CONTENT_LENGTH'});
  19. print "<p>postdata = $postdata</p>n"; # postdata is empty
  20. print "<p>content length = " . $ENV{'CONTENT_LENGTH'} . "</p>n"; # this number seems correct
  21.  
  22. foreach my $key (keys %ENV) {
  23. print "<p>$key --> $ENV{$key}</p>n"; # nothing special here
  24. }
  25.  
  26. ...
  27. LoadModule cgi_module modules/mod_cgi.so
  28. LoadModule perl_module modules/mod_perl.so
  29. ...
  30. ScriptAlias /cgi-bin/ "/[siteroot]/cgi-bin/"
  31. Alias /perl/ "/Applications/MAMP/cgi-bin/"
  32. <IfModule perl_module>
  33. PerlModule ModPerl::Registry
  34. <Location /perl>
  35. SetHandler perl-script
  36. PerlResponseHandler ModPerl::Registry
  37. PerlOptions +ParseHeaders
  38. Options +ExecCGI
  39. </Location>
  40. </IfModule>
  41.  
  42. > perlbrew list-modules
  43.  
  44. CGI
  45. Date::Parse
  46. Encode::Locale
  47. HTML::Parser
  48. HTML::Tagset
  49. HTTP::Date
  50. HTTP::Message
  51. IO::HTML
  52. LWP::MediaTypes
  53. Perl
  54. Sub::Uplevel
  55. Test::Deep
  56. Test::Needs
  57. Test::NoWarnings
  58. Test::Warn
  59. Try::Tiny
  60. URI
Add Comment
Please, Sign In to add comment