-
-
12 Jan 2010 22:06:58 UTC
- Distribution: HTTP-Request-AsCGI
- Module version: 1.2
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Clone repository
- Issues (4)
- Testers (17543 / 25 / 0)
- Kwalitee
Bus factor: 2- 82.72% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (13.84KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Carp
- Class::Accessor
- HTTP::Request
- HTTP::Response
- IO::File
- Test::More
- URI::Escape
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
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.
Module Install Instructions
To install HTTP::Request::AsCGI, copy and paste the appropriate command in to your terminal.
cpanm HTTP::Request::AsCGI
perl -MCPAN -e shell install HTTP::Request::AsCGI
For more information on module installation, please visit the detailed CPAN module installation guide.