->req->remote_user support, new release
[catagits/Catalyst-Controller-WrapCGI.git] / t / lib / TestApp / Controller / Root.pm
index a0557a7..b473a81 100644 (file)
@@ -10,8 +10,14 @@ my $cgi = sub {
     print $cgi->header;
     print 'foo:',$cgi->param('foo'),' bar:',$cgi->param('bar');
     if (my $fh = $cgi->param('baz')) {
-      print 'baz:',<$fh>;
+      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') {
@@ -39,7 +45,9 @@ sub test_filepath_info : Path('/cgi-bin/test_filepathinfo.cgi') {
     });
 }
 
-sub test_script_name : Path('/cgi-bin/test_scriptname.cgi') {
+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 {
@@ -49,4 +57,14 @@ sub test_script_name : Path('/cgi-bin/test_scriptname.cgi') {
     });
 }
 
+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;