failing (TODO) test for multipart/form-data
[catagits/Catalyst-Controller-WrapCGI.git] / t / lib / TestApp / Controller / Root.pm
index 5f479bb..a0557a7 100644 (file)
@@ -1,14 +1,17 @@
 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')) {
+      print 'baz:',<$fh>;
+    }
 };
 
 sub handle_cgi : Path('/cgi-bin/test.cgi') {
@@ -16,4 +19,34 @@ 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 : Path('/cgi-bin/test_scriptname.cgi') {
+    my ($self, $c) = @_;
+
+    $self->cgi_to_response($c, sub {
+        my $cgi = CGI->new;
+        print $cgi->header;
+        print $ENV{SCRIPT_NAME}
+    });
+}
+
 1;