The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

CGI::Emulate::PSGI::Streaming - streaming PSGI adapter for CGI

VERSION

version 1.0.1

SYNOPSIS

  my $app = CGI::Emulate::PSGI::Streaming->handler(sub {
    # Existing CGI code
  });

DESCRIPTION

This module allows an application designed for the CGI environment to run in a PSGI environment, and thus on any of the backends that PSGI supports.

It is a subclass of CGI::Emulate::PSGI. The parsing logic is implemented in CGI::Parse::PSGI::Streaming, which is heavily based on CGI::Parse::PSGI.

Please note that using the PSGI application produced by this module under a non-streaming backend will probably not work.

METHODS

handler

  my $app = CGI::Emulate::PSGI::Streaming->handler($code);

Creates a streaming PSGI application code reference out of CGI code reference.

CGI.pm

(This section is copied from CGI::Emulate::PSGI)

If your application uses CGI, be sure to cleanup the global variables in the handler loop yourself, so:

    my $app = CGI::Emulate::PSGI::Streaming->handler(sub {
        use CGI;
        CGI::initialize_globals();
        my $q = CGI->new;
        # ...
    });

Otherwise previous request variables will be reused in the new requests.

SEE ALSO

CGI::Emulate::PSGI CGI::Parse::PSGI::Streaming PSGI Plack

AUTHOR

Gianni Ceccarelli <gianni.ceccarelli@broadbean.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Broadbean.com.

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