Scroll to navigation

Catalyst::Engine(3pm) User Contributed Perl Documentation Catalyst::Engine(3pm)

NAME

Catalyst::Engine - The Catalyst Engine

SYNOPSIS

See Catalyst.

DESCRIPTION

METHODS

$self->finalize_body($c)

Finalize body. Prints the response output as blocking stream if it looks like a filehandle, otherwise write it out all in one go. If there is no body in the response, we assume you are handling it 'manually', such as for nonblocking style or asynchronous streaming responses. You do this by calling "write" several times (which sends HTTP headers if needed) or you close over "$response->write_fh".

See "write" in Catalyst::Response and "write_fh" in Catalyst::Response for more.

$self->finalize_cookies($c)

Create CGI::Simple::Cookie objects from $c->res->cookies, and set them as response headers.

$self->finalize_error($c)

Output an appropriate error message. Called if there's an error in $c after the dispatch has finished. Will output debug messages if Catalyst is in debug mode, or a `please come back later` message otherwise.

$self->finalize_headers($c)

Allows engines to write headers to response

$self->finalize_uploads($c)

Clean up after uploads, deleting temp files.

$self->prepare_body($c)

sets up the Catalyst::Request object body using HTTP::Body

$self->prepare_body_chunk($c)

Add a chunk to the request body.

$self->prepare_body_parameters($c)

Sets up parameters from body.

$self->prepare_parameters($c)

Sets up parameters from query and post parameters. If parameters have already been set up will clear existing parameters and set up again.

$self->prepare_path($c)

abstract method, implemented by engines.

$self->prepare_request($c)

$self->prepare_query_parameters($c)

process the query string and extract query parameters.

$self->prepare_read($c)

Prepare to read by initializing the Content-Length from headers.

$self->prepare_request(@arguments)

Populate the context object from the request object.

$self->prepare_uploads($c)

$self->write($c, $buffer)

Writes the buffer to the client.

$self->unencoded_write($c, $buffer)

Writes the buffer to the client without encoding. Necessary for already encoded buffers. Used when a $c->write has been done followed by $c->res->body.

$self->read($c, [$maxlength])

Reads from the input stream by calling "$self->read_chunk".

Maintains the read_length and read_position counters as data is read.

$self->read_chunk($c, \$buffer, $length)

Each engine implements read_chunk as its preferred way of reading a chunk of data. Returns the number of bytes read. A return of 0 indicates that there is no more data to be read.

$self->run($app, $server)

Start the engine. Builds a PSGI application and calls the run method on the server passed in, which then causes the engine to loop, handling requests..

build_psgi_app ($app, @args)

Builds and returns a PSGI application closure. (Raw, not wrapped in middleware)

$self->unescape_uri($uri)

Unescapes a given URI using the most efficient method available. Engines such as Apache may implement this using Apache's C-based modules, for example.

$self->finalize_output

<obsolete>, see finalize_body

$self->env

Hash containing environment variables including many special variables inserted by WWW server - like SERVER_*, REMOTE_*, HTTP_* ...

Before accessing environment variables consider whether the same information is not directly available via Catalyst objects $c->request, $c->engine ...

BEWARE: If you really need to access some environment variable from your Catalyst application you should use $c->engine->env->{VARNAME} instead of $ENV{VARNAME}, as in some environments the %ENV hash does not contain what you would expect.

AUTHORS

Catalyst Contributors, see Catalyst.pm

COPYRIGHT

This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.

2022-12-22 perl v5.36.0