From: Rafael Kitover Date: Fri, 19 Feb 2010 04:37:17 +0000 (+0000) Subject: fix fail with HTTP::Request::AsCGI 1.2 and Perl < 5.8.9, release X-Git-Tag: 0.030~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8cf93f587f255563dcff3495bab2b760a6182c29;p=catagits%2FCatalyst-Controller-WrapCGI.git fix fail with HTTP::Request::AsCGI 1.2 and Perl < 5.8.9, release --- diff --git a/Changes b/Changes index 2d8c4d4..f32f79e 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,9 @@ Revision history for Catalyst-Controller-WrapCGI +0.027 2010-02-19 04:34:50 + - fix tests for Perl < 5.8.9 + - fix for HTTP::Request::AsCGI 1.2 + 0.026 2010-01-03 11:37:15 - convert to CGI::Compile - check exit status of non-Perl CGIs diff --git a/Makefile.PL b/Makefile.PL index b383280..7d20e2c 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -5,7 +5,7 @@ all_from 'lib/Catalyst/Controller/WrapCGI.pm'; author 'Matt S. Trout '; requires 'Catalyst' => '5.80015'; -requires 'HTTP::Request::AsCGI' => '0.8';; +requires 'HTTP::Request::AsCGI' => '0.12'; requires 'CGI::Compile' => '0.07'; requires 'File::pushd'; requires 'File::Find::Rule'; diff --git a/lib/Catalyst/Controller/CGIBin.pm b/lib/Catalyst/Controller/CGIBin.pm index b0173be..9cb89b7 100644 --- a/lib/Catalyst/Controller/CGIBin.pm +++ b/lib/Catalyst/Controller/CGIBin.pm @@ -24,11 +24,11 @@ Catalyst::Controller::CGIBin - Serve CGIs from root/cgi-bin =head1 VERSION -Version 0.026 +Version 0.027 =cut -our $VERSION = '0.026'; +our $VERSION = '0.027'; =head1 SYNOPSIS diff --git a/lib/Catalyst/Controller/WrapCGI.pm b/lib/Catalyst/Controller/WrapCGI.pm index 27da47d..0028b64 100644 --- a/lib/Catalyst/Controller/WrapCGI.pm +++ b/lib/Catalyst/Controller/WrapCGI.pm @@ -21,11 +21,11 @@ Catalyst::Controller::WrapCGI - Run CGIs in Catalyst =head1 VERSION -Version 0.026 +Version 0.027 =cut -our $VERSION = '0.026'; +our $VERSION = '0.027'; =head1 SYNOPSIS @@ -197,8 +197,6 @@ sub wrap_cgi { } } - my $filtered_env = $self->_filtered_env(\%ENV); - $req->content($body_content); $req->content_length(length($body_content)); @@ -217,7 +215,6 @@ sub wrap_cgi { my $env = HTTP::Request::AsCGI->new( $req, ($username ? (REMOTE_USER => $username) : ()), - %$filtered_env, PATH_INFO => $path_info, # eww, this is likely broken: FILEPATH_INFO => '/'.$c->action.$path_info, @@ -232,6 +229,8 @@ sub wrap_cgi { my $saved_error; + local %ENV = %{ $self->_filtered_env(\%ENV) }; + $env->setup; eval { $call->() }; $saved_error = $@; diff --git a/lib/CatalystX/GlobalContext.pm b/lib/CatalystX/GlobalContext.pm index c3653a3..373373f 100644 --- a/lib/CatalystX/GlobalContext.pm +++ b/lib/CatalystX/GlobalContext.pm @@ -15,11 +15,11 @@ CatalystX::GlobalContext - Export Catalyst Context =head1 VERSION -Version 0.026 +Version 0.027 =cut -our $VERSION = '0.026'; +our $VERSION = '0.027'; =head1 SYNOPSIS diff --git a/t/cgibin.t b/t/cgibin.t index e62b1b1..ce36f1b 100644 --- a/t/cgibin.t +++ b/t/cgibin.t @@ -10,7 +10,12 @@ use Test::More; use HTTP::Request::Common; my %orig_sig; -BEGIN { %orig_sig = %SIG; } +BEGIN { + %orig_sig = %SIG; +# perl < 5.8.9 won't set a %SIG entry to undef, it sets it to '' + %orig_sig = map { defined $_ ? $_ : '' } %orig_sig + if $] < 5.008009; +} use Catalyst::Test 'TestCGIBin'; @@ -18,7 +23,6 @@ use Catalyst::Test 'TestCGIBin'; $ENV{MOD_PERL} = "mod_perl/2.0"; is_deeply \%SIG, \%orig_sig, '%SIG is preserved on compile'; -%SIG = %orig_sig; my $response = request POST '/my-bin/path/test.pl', [ foo => 'bar',