2 HTTP::Request::AsCGI - Setup a CGI enviroment from a HTTP::Request
7 use HTTP::Request::AsCGI;
9 my $request = HTTP::Request->new( GET => 'http://www.host.com/' );
13 my $c = HTTP::Request::AsCGI->new($request)->setup;
17 $q->start_html('Hello World'),
18 $q->h1('Hello World'),
23 # enviroment and descriptors will automatically be restored
24 # when $c is destructed.
27 while ( my $line = $stdout->getline ) {
32 Provides a convinient way of setting up an CGI enviroment from a
36 new ( $request [, key => value ] )
37 Contructor, first argument must be a instance of HTTP::Request
38 followed by optional pairs of environment key and value.
41 Returns a hashref containing the environment that will be used in
42 setup. Changing the hashref after setup has been called will have no
46 Setups the environment and descriptors.
49 Restores the enviroment and descriptors. Can only be called after
53 Returns the request given to constructor.
56 Returns a HTTP::Response. Can only be called after restore.
59 Accessor for handle that will be used for STDIN, must be a real
60 seekable handle with an file descriptor. Defaults to a tempoary
64 Accessor for handle that will be used for STDOUT, must be a real
65 seekable handle with an file descriptor. Defaults to a tempoary
69 Accessor for handle that will be used for STDERR, must be a real
70 seekable handle with an file descriptor.
73 examples directory in this distribution.
75 Test::WWW::Mechanize::CGI
78 Thomas L. Shinnick for his valuable win32 testing.
81 Christian Hansen, "ch@ngmedia.com"
84 This library is free software. You can redistribute it and/or modify it
85 under the same terms as perl itself.