Write an empty STDIN PDU to indicate stdin EOF.
[catagits/fcgi2.git] / examples / tiny-perl-fcgi
1 #!./perl
2 #
3 #  tiny-perl-fcgi --
4
5 #       Perl-5 FastCGI example program
6
7 # Copyright (c) 1996 Open Market, Inc.
8 #
9 # See the file "LICENSE.TERMS" for information on usage and redistribution
10 # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11
12 #  $Id: tiny-perl-fcgi,v 1.1 1997/09/16 15:36:29 stanleyg Exp $
13 #
14
15
16 use FCGI;
17 #
18 # Work around the "empty initial environment" bug
19 #
20 while (($ignore) = each %ENV) {
21 }
22
23 $count = 0;
24 while(FCGI::accept() >= 0) {
25     print("Content-type: text/html\r\n\r\n",
26           "<title>FastCGI Hello! (Perl)</title>\n",
27           "<h1>FastCGI Hello! (Perl)</h1>\n",
28           "Request number ", ++$count,
29           " running on host <i>$ENV{'SERVER_NAME'}</i>\n");
30 }