01f012abc3f1c8d68716d6ed85af47af8fd8cab4
[dh-make-perl] / dev / i386 / libwww-perl / libwww-perl-5.813 / t / net / cgi-bin / nph-slowdata
1 #!/usr/local/bin/perl
2
3 # This script outputs some data slowly. It can be used to check that
4 # pipelined processing of response content really works.  We use syswrite
5 # so that the script will notice when the connection is broken.
6
7 out("HTTP/1.0 200 OK\r
8 Content-Type: text/plain\r
9 \r
10 ");
11
12 for (1..5) {
13     out("The number is now $_\n");
14     sleep(1);
15 }
16 exit;
17
18
19 sub out
20 {
21     my $data = shift;
22     my $l = length $data;
23     if (syswrite(STDOUT, $data, $l) != $l) {
24         exit 1;
25     }
26 }