WrapCGI - file uploads support
[catagits/Catalyst-Controller-WrapCGI.git] / t / lib / TestApp / Controller / Root.pm
CommitLineData
457c1d76 1package TestApp::Controller::Root;
2
3use parent 'Catalyst::Controller::WrapCGI';
12d29ebf 4use CGI ();
457c1d76 5
6__PACKAGE__->config->{namespace} = '';
7
8my $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')) {
16db0bfc 13 local $/;
14 print ' baz:',<$fh>;
d5bb451f 15 }
16db0bfc 16 die $cgi->cgi_error if $cgi->cgi_error;
457c1d76 17};
18
19sub handle_cgi : Path('/cgi-bin/test.cgi') {
20 my ($self, $c) = @_;
21 $self->cgi_to_response($c, $cgi);
22}
23
0d83c5de 24sub test_path_info : Path('/cgi-bin/test_pathinfo.cgi') {
25 my ($self, $c) = @_;
26
27 $self->cgi_to_response($c, sub {
28 my $cgi = CGI->new;
29 print $cgi->header;
30 print $ENV{PATH_INFO}
31 });
32}
33
f410f043 34sub test_filepath_info : Path('/cgi-bin/test_filepathinfo.cgi') {
35 my ($self, $c) = @_;
36
37 $self->cgi_to_response($c, sub {
38 my $cgi = CGI->new;
39 print $cgi->header;
40 print $ENV{FILEPATH_INFO}
41 });
42}
43
44sub test_script_name : Path('/cgi-bin/test_scriptname.cgi') {
45 my ($self, $c) = @_;
46
47 $self->cgi_to_response($c, sub {
48 my $cgi = CGI->new;
49 print $cgi->header;
50 print $ENV{SCRIPT_NAME}
51 });
52}
53
457c1d76 541;