The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SCGI

DESCRIPTION

This module is for implementing an SCGI interface for an application server.

SYNOPISIS

  use SCGI;
  use IO::Socket;
  
  my $socket = IO::Socket::INET->new(Listen => 5, ReuseAddr => 1, LocalPort => 8080)
    or die "cannot bind to port 8080: $!";
  
  my $scgi = SCGI->new($socket, blocking => 1);
  
  while (my $request = $scgi->accept) {
    $request->read_env;
    read $request->connection, my $body, $request->env->{CONTENT_LENGTH};
    print $request->connection "HTTP/1.0 200 OK\r\nContent-Type: text/plain\r\n\r\nHello!\n";
  }

public methods

new

Takes a socket followed by a set of options (key value pairs) and returns a new SCGI listener. Currently the only supported option is blocking, to indicate that the socket blocks and that the library should not treat it accordingly. By default blocking is false. (NOTE: blocking is now a named rather than positional parameter. Using as a positional parameter will produce a warning in this version and will throw an exception in the next version).

accept

Accepts a connection from the socket and returns an SCGI::Request for it.

socket

Returns the socket that was passed to the constructor.

blocking

Returns true if it was indicated that the socket should be blocking when the SCGI object was created.

AUTHOR

Thomas Yandell mailto:tom+scgi@vipercode.com

COPYRIGHT

Copyright 2005 Viper Code Limited. All rights reserved.

LICENSE

This file is part of SCGI (perl SCGI library).

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.