File: test

package info (click to toggle)
libwww-perl 5.36-1.1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 848 kB
  • ctags: 400
  • sloc: perl: 6,366; makefile: 51; sh: 6
file content (28 lines) | stat: -rwxr-xr-x 526 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/local/bin/perl

$| = 1;
print "Content-type: text/plain

";

if (@ARGV) {
    print "ARGS: ";
    print join(", ", map { $_ = qq{"$_"} } @ARGV);
    print "\n\n";
} else {
    print "No command line arguments passed to script\n\n";
}

while (($key,$val) = each %ENV) {
   print "$key=$val\n";
}

if ($ENV{CONTENT_LENGTH}) {
    $len = $ENV{CONTENT_LENGTH};
    while ($len) {
	$n = sysread(STDIN, $content, $len, length $content);
	last unless defined $n;
	$len -= $n;
    }
    print "\nContent\n-------\n$content";
}