X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FTestApp%2FController%2FRoot.pm;h=b473a81e9c6e0bbbf17944aab4893779868ff525;hb=b9548267055b5d4dd01a342a40cc6e0ddf166460;hp=5f479bba4312443b93b787cab4335a37314b6449;hpb=457c1d76ed6730ef07a1ab35b1ec1c47d6c4f19d;p=catagits%2FCatalyst-Controller-WrapCGI.git diff --git a/t/lib/TestApp/Controller/Root.pm b/t/lib/TestApp/Controller/Root.pm index 5f479bb..b473a81 100644 --- a/t/lib/TestApp/Controller/Root.pm +++ b/t/lib/TestApp/Controller/Root.pm @@ -1,14 +1,23 @@ package TestApp::Controller::Root; use parent 'Catalyst::Controller::WrapCGI'; +use CGI (); __PACKAGE__->config->{namespace} = ''; my $cgi = sub { - use CGI ':standard'; - - print header; - print 'foo:',param('foo'),' bar:',param('bar') + my $cgi = CGI->new; + print $cgi->header; + print 'foo:',$cgi->param('foo'),' bar:',$cgi->param('bar'); + if (my $fh = $cgi->param('baz')) { + local $/; + print ' baz:',<$fh>; + } + if (my $fh = $cgi->param('quux')) { + local $/; + print ' quux:',<$fh>; + } + die $cgi->cgi_error if $cgi->cgi_error; }; sub handle_cgi : Path('/cgi-bin/test.cgi') { @@ -16,4 +25,46 @@ sub handle_cgi : Path('/cgi-bin/test.cgi') { $self->cgi_to_response($c, $cgi); } +sub test_path_info : Path('/cgi-bin/test_pathinfo.cgi') { + my ($self, $c) = @_; + + $self->cgi_to_response($c, sub { + my $cgi = CGI->new; + print $cgi->header; + print $ENV{PATH_INFO} + }); +} + +sub test_filepath_info : Path('/cgi-bin/test_filepathinfo.cgi') { + my ($self, $c) = @_; + + $self->cgi_to_response($c, sub { + my $cgi = CGI->new; + print $cgi->header; + print $ENV{FILEPATH_INFO} + }); +} + +sub test_script_name_root : Chained('/') PathPart('cgi-bin') CaptureArgs(1) {} + +sub test_script_name : Chained('test_script_name_root') PathPart('test_scriptname.cgi') Args { + my ($self, $c) = @_; + + $self->cgi_to_response($c, sub { + my $cgi = CGI->new; + print $cgi->header; + print $ENV{SCRIPT_NAME} + }); +} + +sub test_remote_user : Path('/cgi-bin/test_remote_user.cgi') Args(0) { + my ($self, $c) = @_; + + $self->cgi_to_response($c, sub { + my $cgi = CGI->new; + print $cgi->header; + print $ENV{REMOTE_USER} + }); +} + 1;