Commit | Line | Data |
457c1d76 |
1 | package TestApp::Controller::Root; |
2 | |
3 | use parent 'Catalyst::Controller::WrapCGI'; |
12d29ebf |
4 | use CGI (); |
457c1d76 |
5 | |
6 | __PACKAGE__->config->{namespace} = ''; |
7 | |
8 | my $cgi = sub { |
12d29ebf |
9 | my $cgi = CGI->new; |
10 | print $cgi->header; |
a032b7f8 |
11 | print 'foo:',$cgi->param('foo'),' bar:',$cgi->param('bar'); |
d5bb451f |
12 | if (my $fh = $cgi->param('baz')) { |
13 | print 'baz:',<$fh>; |
14 | } |
457c1d76 |
15 | }; |
16 | |
17 | sub handle_cgi : Path('/cgi-bin/test.cgi') { |
18 | my ($self, $c) = @_; |
19 | $self->cgi_to_response($c, $cgi); |
20 | } |
21 | |
0d83c5de |
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 | |
f410f043 |
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 | |
457c1d76 |
52 | 1; |