"Fossies" - the Fresh Open Source Software Archive

Member "libwww-perl-6.43/xt/author/net/cgi-bin/test" (26 Nov 2019, 582 Bytes) of package /linux/www/libwww-perl-6.43.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl
    2 use strict;
    3 use warnings;
    4 
    5 $| = 1;
    6 print "Content-type: text/plain\n\n";
    7 
    8 if (@ARGV) {
    9     print "ARGS: ";
   10     print join(", ", map { $_ = qq{"$_"} } @ARGV);
   11     print "\n\n";
   12 } else {
   13     print "No command line arguments passed to script\n\n";
   14 }
   15 
   16 for my $key (keys %ENV) {
   17     print $key, '=', $ENV{$key}, "\n";
   18 }
   19 
   20 if ($ENV{CONTENT_LENGTH}) {
   21     my $len = $ENV{CONTENT_LENGTH};
   22     my $content;
   23     while ($len) {
   24         my $n = sysread(STDIN, $content, $len);
   25         last unless defined $n;
   26         $len -= $n;
   27     }
   28     print "\nContent\n-------\n$content";
   29 }