Rand Stats

FastCGI

zef:raku-community-modules

Actions Status Actions Status Actions Status

NAME

FastCGI - a FastCGI library for Raku

SYNOPSIS

use FastCGI;

my $fcgi = FastCGI.new( :port(9119) );

$fcgi.handle: &handler;

DESCRIPTION

A library for building web applications using FastCGI in Raku. Uses a PSGI-compliant interface by default, so you can use it with any PSGI-compliant frameworks, such as WWW::App.

Status

Basic functionality works, but is currently fairly slow using the pure source implementation of the FastCGI protocol.

I haven't done any extensive testing using input streams or error streams.

Example

Currently the use of the handler call is required. More advanced use, such as with the new SCGI is planned, but will require some significant refactoring.

use FastCGI;

my $fcgi = FastCGI.new( :port(9119) );

my $handler = sub (%env) {
    my $name = %env<QUERY_STRING> || 'World';
    my $status = '200';
    my @headers = 'Content-Type' => 'text/plain';
    my @body = "Hello $name\n";;
    [ $status, @headers, @body ]
}

$fcgi.handle: $handler;

TODO

AUTHOR

Timothy Totten

COPYRIGHT AND LICENSE

Copyright 2013 - 2016 Timothy Totten

Copyright 2017 - 2026 Raku Community

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.