NAME

AnyEvent::SCGI - Event based SCGI server

SYNOPSIS

use AnyEvent::SCGI;
use HTTP::Headers;

scgi_server $server_name, $port, sub {
    my $handle = shift;
    my $env = shift;
    my $content_ref = shift; # undef if none
    my $fatal_error = shift;
    my $error_string = shift;

    my $headers = HTTP::Headers->new(
        'Status' => '200 OK',
        'Content-Type' => 'text/plain',
        'Connection' => 'close',
    );

    $handle->push_write($headers->as_string . "\r\nHello World!\r\n");
}

FUNCTIONS

scgi_server $host, $port, $handler_cb->($handle,\%env,\$content, $fatal, $error)

This method creates a TCP socket on the given host and port by calling tcp_server() from AnyEvent::Socket.

Calls $handler_cb when a valid SCGI request has been received. The first parameter is the AnyEvent::Handle If the request has a payload, a reference to it is passed in as the $content parameter.

On error, \%env and \$content are undef and the usual $fatal and $error parameters are passed in as subsequent arguments. On "EOF" from the client, fatal is "0" and error is 'EOF'.

AUTHORS

Jeremy Stashewsky <stash@cpan.org>

Kevin Jones <kevinj@cpan.org>

BUGS

Please report any bugs or feature requests to bug-anyevent-scgi at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=AnyEvent-SCGI. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc AnyEvent::SCGI

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2009 Jeremy Stashewsky Copyright 2009 Kevin Jones

Copyright 2009 Socialtext Inc., all rights reserved.

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