failing (TODO) test for multipart/form-data
[catagits/Catalyst-Controller-WrapCGI.git] / t / lib / TestApp / Controller / Root.pm
1 package TestApp::Controller::Root;
2
3 use parent 'Catalyst::Controller::WrapCGI';
4 use CGI ();
5
6 __PACKAGE__->config->{namespace} = '';
7
8 my $cgi = sub {
9     my $cgi = CGI->new;
10     print $cgi->header;
11     print 'foo:',$cgi->param('foo'),' bar:',$cgi->param('bar');
12     if (my $fh = $cgi->param('baz')) {
13       print 'baz:',<$fh>;
14     }
15 };
16
17 sub handle_cgi : Path('/cgi-bin/test.cgi') {
18     my ($self, $c) = @_;
19     $self->cgi_to_response($c, $cgi);
20 }
21
22 sub test_path_info : Path('/cgi-bin/test_pathinfo.cgi') {
23     my ($self, $c) = @_;
24
25     $self->cgi_to_response($c, sub {
26         my $cgi = CGI->new;
27         print $cgi->header;
28         print $ENV{PATH_INFO}
29     });
30 }
31
32 sub test_filepath_info : Path('/cgi-bin/test_filepathinfo.cgi') {
33     my ($self, $c) = @_;
34
35     $self->cgi_to_response($c, sub {
36         my $cgi = CGI->new;
37         print $cgi->header;
38         print $ENV{FILEPATH_INFO}
39     });
40 }
41
42 sub test_script_name : Path('/cgi-bin/test_scriptname.cgi') {
43     my ($self, $c) = @_;
44
45     $self->cgi_to_response($c, sub {
46         my $cgi = CGI->new;
47         print $cgi->header;
48         print $ENV{SCRIPT_NAME}
49     });
50 }
51
52 1;