[Catalyst-commits] r12186 - in HTTP-Request-AsCGI/trunk: .
lib/HTTP/Request
NoFixedAbode at dev.catalyst.perl.org
NoFixedAbode at dev.catalyst.perl.org
Fri Dec 4 16:26:08 GMT 2009
Author: NoFixedAbode
Date: 2009-12-04 16:26:08 +0000 (Fri, 04 Dec 2009)
New Revision: 12186
Modified:
HTTP-Request-AsCGI/trunk/Changes
HTTP-Request-AsCGI/trunk/lib/HTTP/Request/AsCGI.pm
Log:
setup now concatenates its environment to %ENV instead of replacing it
Modified: HTTP-Request-AsCGI/trunk/Changes
===================================================================
--- HTTP-Request-AsCGI/trunk/Changes 2009-12-04 13:51:55 UTC (rev 12185)
+++ HTTP-Request-AsCGI/trunk/Changes 2009-12-04 16:26:08 UTC (rev 12186)
@@ -1,11 +1,10 @@
This file documents the revision history for Perl extension HTTP::Request::AsCGI.
-1.0 2009-12-03
- - added test to check that $ENV is preserved after setup is called
-
1.0 2009-11-30
- Change how PATH_INFO is decoded so that everything is decoded, including
URI reserved characters (RT#50082)
+ - added test to check that %ENV is preserved after setup is called
+ - setup now concatenates its environment to %ENV instead of replacing it
0.9 2009-04-27
- unescape PATH_INFO more safely
Modified: HTTP-Request-AsCGI/trunk/lib/HTTP/Request/AsCGI.pm
===================================================================
--- HTTP-Request-AsCGI/trunk/lib/HTTP/Request/AsCGI.pm 2009-12-04 13:51:55 UTC (rev 12185)
+++ HTTP-Request-AsCGI/trunk/lib/HTTP/Request/AsCGI.pm 2009-12-04 16:26:08 UTC (rev 12186)
@@ -156,7 +156,7 @@
{
no warnings 'uninitialized';
- %ENV = %{ $self->environment };
+ %ENV = %ENV, %{ $self->environment };
}
if ( $INC{'CGI.pm'} ) {
@@ -181,7 +181,7 @@
$headers .= $line;
last if $headers =~ /\x0d?\x0a\x0d?\x0a$/;
}
-
+
unless ( defined $headers ) {
$headers = "HTTP/1.1 500 Internal Server Error\x0d\x0a";
}
@@ -208,7 +208,7 @@
$response->code($code);
$response->message($message);
}
-
+
my $length = ( stat( $self->stdout ) )[7] - tell( $self->stdout );
if ( $response->code == 500 && !$length ) {
@@ -306,36 +306,36 @@
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;
}
-
+
=head1 DESCRIPTION
Provides a convenient way of setting up an CGI environment from an HTTP::Request.
=head1 METHODS
-=over 4
+=over 4
=item new ( $request [, key => value ] )
@@ -344,7 +344,7 @@
=item environment
-Returns a hashref containing the environment that will be used in setup.
+Returns a hashref containing the environment that will be used in setup.
Changing the hashref after setup has been called will have no effect.
=item setup
More information about the Catalyst-commits
mailing list