->req->remote_user support, new release
[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 }
01c35d4e 16 if (my $fh = $cgi->param('quux')) {
17 local $/;
18 print ' quux:',<$fh>;
19 }
16db0bfc 20 die $cgi->cgi_error if $cgi->cgi_error;
457c1d76 21};
22
23sub handle_cgi : Path('/cgi-bin/test.cgi') {
24 my ($self, $c) = @_;
25 $self->cgi_to_response($c, $cgi);
26}
27
0d83c5de 28sub test_path_info : Path('/cgi-bin/test_pathinfo.cgi') {
29 my ($self, $c) = @_;
30
31 $self->cgi_to_response($c, sub {
32 my $cgi = CGI->new;
33 print $cgi->header;
34 print $ENV{PATH_INFO}
35 });
36}
37
f410f043 38sub test_filepath_info : Path('/cgi-bin/test_filepathinfo.cgi') {
39 my ($self, $c) = @_;
40
41 $self->cgi_to_response($c, sub {
42 my $cgi = CGI->new;
43 print $cgi->header;
44 print $ENV{FILEPATH_INFO}
45 });
46}
47
17a050f8 48sub test_script_name_root : Chained('/') PathPart('cgi-bin') CaptureArgs(1) {}
49
50sub test_script_name : Chained('test_script_name_root') PathPart('test_scriptname.cgi') Args {
f410f043 51 my ($self, $c) = @_;
52
53 $self->cgi_to_response($c, sub {
54 my $cgi = CGI->new;
55 print $cgi->header;
56 print $ENV{SCRIPT_NAME}
57 });
58}
59
b9548267 60sub test_remote_user : Path('/cgi-bin/test_remote_user.cgi') Args(0) {
61 my ($self, $c) = @_;
62
63 $self->cgi_to_response($c, sub {
64 my $cgi = CGI->new;
65 print $cgi->header;
66 print $ENV{REMOTE_USER}
67 });
68}
69
457c1d76 701;