From: Rafael Kitover Date: Sun, 6 Dec 2009 03:50:13 +0000 (+0000) Subject: fix tests, redo (c) sections, saner is_perl_cgi, release X-Git-Tag: 0.030~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Controller-WrapCGI.git;a=commitdiff_plain;h=efa4a4342a71f4e26ad25301755b090be880e159 fix tests, redo (c) sections, saner is_perl_cgi, release --- diff --git a/lib/Catalyst/Controller/CGIBin.pm b/lib/Catalyst/Controller/CGIBin.pm index e332ef4..183befd 100644 --- a/lib/Catalyst/Controller/CGIBin.pm +++ b/lib/Catalyst/Controller/CGIBin.pm @@ -228,8 +228,10 @@ sub is_perl_cgi { open STDERR, '>&', \*NULL; close STDIN; - do $cgi; + eval { $self->wrap_perl_cgi($cgi, '__DUMMY__') }; + IO::File->new(">$tempfile")->print($@); + exit; } @@ -324,14 +326,6 @@ __PACKAGE__->meta->make_immutable; L, L, L, L, L -=head1 AUTHOR - -Rafael Kitover, C<< >> - -=head1 CONTRIBUTORS - -Hans Dieter Pearcey, C<< >> - =head1 BUGS Please report any bugs or feature requests to C =back +=head1 AUTHOR + +See L and +L. + =head1 COPYRIGHT & LICENSE -Copyright (c) 2008 Rafael Kitover +Copyright (c) 2008-2009 L and +L. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Catalyst/Controller/WrapCGI.pm b/lib/Catalyst/Controller/WrapCGI.pm index a51afea..9fe7843 100644 --- a/lib/Catalyst/Controller/WrapCGI.pm +++ b/lib/Catalyst/Controller/WrapCGI.pm @@ -351,16 +351,6 @@ Original development sponsored by L L, L, L, L, L -=head1 AUTHOR - -Matt S. Trout, C<< >> - -=head1 CONTRIBUTORS - -Rafael Kitover C<< >> - -Hans Dieter Pearcey C<< >> - =head1 BUGS Please report any bugs or feature requests to C =back +=head1 AUTHOR + +Matt S. Trout C<< >> + +=head1 CONTRIBUTORS + +Rafael Kitover C<< >> + +Hans Dieter Pearcey C<< >> + =head1 COPYRIGHT & LICENSE -Copyright (c) 2008 Matt S. Trout +Copyright (c) 2008-2009 L and +L. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/CatalystX/GlobalContext.pm b/lib/CatalystX/GlobalContext.pm index 792a746..879ff16 100644 --- a/lib/CatalystX/GlobalContext.pm +++ b/lib/CatalystX/GlobalContext.pm @@ -77,10 +77,6 @@ sub set_context { L, L, L -=head1 AUTHOR - -Rafael Kitover, C<< >> - =head1 BUGS Please report any bugs or feature requests to C =back +=head1 AUTHOR + +See L and +L. + =head1 COPYRIGHT & LICENSE -Copyright (c) 2008 Rafael Kitover +Copyright (c) 2008-2009 L and +L. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/t/global-context.t b/t/global-context.t index bc3238d..396d435 100644 --- a/t/global-context.t +++ b/t/global-context.t @@ -2,35 +2,8 @@ use strict; use warnings; - +use lib 't/lib'; use Test::More tests => 1; - -{ - package TestApp; - - use Catalyst; - use CatalystX::GlobalContext (); - - sub auto : Private { - my ($self, $c) = @_; - CatalystX::GlobalContext->set_context($c); - 1; - } - - sub dummy : Local { - my ($self, $c) = @_; - $c->res->body(Dongs->foo); - } - - __PACKAGE__->setup; - - package Dongs; - - use CatalystX::GlobalContext '$c'; - - sub foo { $c->action } -} - -use Catalyst::Test 'TestApp'; +use Catalyst::Test 'TestGC'; is(get('/dummy'), 'dummy', 'global context works'); diff --git a/t/lib/Dongs.pm b/t/lib/Dongs.pm new file mode 100644 index 0000000..01236bb --- /dev/null +++ b/t/lib/Dongs.pm @@ -0,0 +1,9 @@ +package Dongs; + +use strict; +use warnings; +use CatalystX::GlobalContext '$c'; + +sub foo { $c->action } + +1; diff --git a/t/lib/TestGC.pm b/t/lib/TestGC.pm new file mode 100644 index 0000000..60fd653 --- /dev/null +++ b/t/lib/TestGC.pm @@ -0,0 +1,8 @@ +package TestGC; + +use Catalyst::Runtime '5.70'; +use parent 'Catalyst'; + +__PACKAGE__->setup; + +1; diff --git a/t/lib/TestGC/Controller/Root.pm b/t/lib/TestGC/Controller/Root.pm new file mode 100644 index 0000000..6bc5ef5 --- /dev/null +++ b/t/lib/TestGC/Controller/Root.pm @@ -0,0 +1,22 @@ +package TestGC::Controller::Root; + +use strict; +use warnings; +use base 'Catalyst::Controller'; +use CatalystX::GlobalContext (); +use Dongs (); + +__PACKAGE__->config->{namespace} = ''; + +sub auto : Private { + my ($self, $c) = @_; + CatalystX::GlobalContext->set_context($c); + 1; +} + +sub dummy : Local { + my ($self, $c) = @_; + $c->res->body(Dongs->foo); +} + +1; diff --git a/t/wrap-cgi.t b/t/wrap-cgi.t index 0586686..9a2d6b0 100644 --- a/t/wrap-cgi.t +++ b/t/wrap-cgi.t @@ -21,7 +21,7 @@ is($response->content, 'foo:bar bar:baz', 'POST to CGI'); $response = request POST '/cgi-bin/test.cgi', [ foo => 'bar', bar => 'baz', -], 'Content-Type' => 'form-data'; +], User_Agent => 'perl/5', Content_Type => 'form-data'; is($response->content, 'foo:bar bar:baz', 'POST to CGI (form-data)'); @@ -38,12 +38,13 @@ $response = request POST '/cgi-bin/test.cgi', ], quux => [ undef, quux => Content => 4 ], ], - 'Content-Type' => 'form-data'; + User_Agent => 'perl/5', + Content_Type => 'form-data'; is($response->content, 'foo:1 bar:2 baz:3 quux:4', 'POST with file upload'); $response = request '/cgi-bin/test_pathinfo.cgi/path/%2Finfo'; -is($response->content, '/path/%2Finfo', 'PATH_INFO is correct'); +is($response->content, '/path//info', 'PATH_INFO is correct'); $response = request '/cgi-bin/test_filepathinfo.cgi/path/%2Finfo'; is($response->content, '/test_filepath_info/path/%2Finfo',