GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Mojo::Server::FastCGI(3) User Contributed Perl Documentation Mojo::Server::FastCGI(3)

Mojo::Server::FastCGI - FastCGI Server

  use Mojo::Server::FastCGI;

  my $fcgi = Mojo::Server::FastCGI->new;
  $fcgi->on_request(sub {
    my ($self, $tx) = @_;

    # Request
    my $method = $tx->req->method;
    my $path   = $tx->req->url->path;

    # Response
    $tx->res->code(200);
    $tx->res->headers->content_type('text/plain');
    $tx->res->body("$method request for $path!");

    # Resume transaction
    $tx->resume;
  });
  $fcgi->run;

Mojo::Server::FastCGI is a portable pure-Perl FastCGI implementation as described in the "FastCGI Specification".

See Mojolicious::Guides::Cookbook for deployment recipes.

Mojo::Server::FastCGI inherits all attributes from Mojo::Server.

Mojo::Server::FastCGI inherits all methods from Mojo::Server and implements the following new ones.

  my $c = $fcgi->accept_connection;

Accept FastCGI connection.

  my ($type, $id, $body) = $fcgi->read_record($c);

Parse FastCGI record.

  my $tx = $fcgi->read_request($c);

Parse FastCGI request.

  my $name = $fcgi->role_name(3);

FastCGI role name.

  my $number = $fcgi->role_number('FILTER');

FastCGI role number.

  $fcgi->run;

Start FastCGI.

  my $name = $fcgi->type_name(5);

FastCGI type name.

  my $number = $fcgi->type_number('STDIN');

FastCGI type number.

  $fcgi->write_record($c, 'STDOUT', $id, 'HTTP/1.1 200 OK');

Write FastCGI record.

  $fcgi->write_response($tx);

Write FastCGI response.

You can set the "MOJO_FASTCGI_DEBUG" environment variable to get some advanced diagnostics information sent to the Mojo logger as "debug" messages.

  MOJO_FASTCGI_DEBUG=1

Mojolicious, Mojolicious::Guides, <http://mojolicio.us>.
2013-01-31 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.