Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

http::request::ascgi(3pm) [debian man page]

HTTP::Request::AsCGI(3pm)				User Contributed Perl Documentation				 HTTP::Request::AsCGI(3pm)

NAME
HTTP::Request::AsCGI - Set up a CGI environment from an HTTP::Request VERSION
version 1.2 SYNOPSIS
use CGI; use HTTP::Request; use HTTP::Request::AsCGI; my $request = HTTP::Request->new( GET => 'http://www.host.com/' ); my $stdout; { my $c = HTTP::Request::AsCGI->new($request)->setup; my $q = CGI->new; print $q->header, $q->start_html('Hello World'), $q->h1('Hello World'), $q->end_html; $stdout = $c->stdout; # environment and descriptors will automatically be restored # when $c is destructed. } while ( my $line = $stdout->getline ) { print $line; } DESCRIPTION
Provides a convenient way of setting up an CGI environment from an HTTP::Request. METHODS
new ( $request [, key => value ] ) Constructor. The first argument must be a instance of HTTP::Request, followed by optional pairs of environment key and value. environment Returns a hashref containing the environment that will be used in setup. Changing the hashref after setup has been called will have no effect. setup Sets up the environment and descriptors. restore Restores the environment and descriptors. Can only be called after setup. request Returns the request given to constructor. response Returns a HTTP::Response. Can only be called after restore. stdin Accessor for handle that will be used for STDIN, must be a real seekable handle with an file descriptor. Defaults to a tempoary IO::File instance. stdout Accessor for handle that will be used for STDOUT, must be a real seekable handle with an file descriptor. Defaults to a tempoary IO::File instance. stderr Accessor for handle that will be used for STDERR, must be a real seekable handle with an file descriptor. SEE ALSO
examples directory in this distribution. WWW::Mechanize::CGI Test::WWW::Mechanize::CGI THANKS TO
Thomas L. Shinnick for his valuable win32 testing. AUTHORS
Christian Hansen <ch@ngmedia.com> Hans Dieter Pearcey <hdp@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Christian Hansen <ch@ngmedia.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. perl v5.10.1 2010-01-12 HTTP::Request::AsCGI(3pm)

Check Out this Related Man Page

HTTP::Server::Simple::CGI(3pm)				User Contributed Perl Documentation			    HTTP::Server::Simple::CGI(3pm)

NAME
HTTP::Server::Simple::CGI - CGI.pm-style version of HTTP::Server::Simple DESCRIPTION
HTTP::Server::Simple was already simple, but some smart-ass pointed out that there is no CGI in HTTP, and so this module was born to isolate the CGI.pm-related parts of this handler. accept_hook The accept_hook in this sub-class clears the environment to the start-up state. post_setup_hook Initializes the global CGI object, as well as other environment settings. cgi_class [Classname] Gets or sets the class to use for creating the $cgi object passed to "handle_request". Called with a single argument, it sets the coderef. Called with no arguments, it returns this field's current value. To provide an initialization subroutine to be run in the post_setup_hook, see "cgi_init". e.g. $server->cgi_class('CGI'); $server->cgi_init(sub { require CGI; CGI::initialize_globals(); }); or, if you want to use CGI::Simple, $server->cgi_class('CGI::Simple'); $server->cgi_init(sub { require CGI::Simple; }); cgi_init [CODEREF] A coderef to run in the post_setup_hook. Called with a single argument, it sets the coderef. Called with no arguments, it returns this field's current value. setup This method sets up CGI environment variables based on various meta-headers, like the protocol, remote host name, request path, etc. See the docs in HTTP::Server::Simple for more detail. handle_request CGI This routine is called whenever your server gets a request it can handle. It's called with a CGI object that's been pre-initialized. You want to override this method in your subclass handler Handler implemented as part of HTTP::Server::Simple API perl v5.10.1 2010-04-02 HTTP::Server::Simple::CGI(3pm)
Man Page