CGI::Application::Plugin::ApacheAllow CGI::Application to use Apache::* modules without interference | |
Download |
CGI::Application::Plugin::Apache Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Michael Peters
- Publisher web site:
- http://search.cpan.org/~wonko/CGI-Application-Dispatch-2.12/lib/CGI/Application/Dispatch.pm
CGI::Application::Plugin::Apache Tags
CGI::Application::Plugin::Apache Description
Allow CGI::Application to use Apache::* modules without interference CGI::Application::Plugin::Apache is a Perl module to allow CGI::Application to use Apache::* modules without interference.SYNOPSIS use base 'CGI::Application'; use CGI::Application::Plugin::Apache qw(:all); # then later we join our hero in a run mode... sub mode1 { my $self = shift; my $q = $self->query(); # $q is an Apache::Request obj not a CGI.pm obj # do some stuff # now we can bake a cookie using Apache::Cookie without interference $cookie = Apache::Cookie->new( $q, -name => 'foo', -value => 'bar', -expires => '+2h', ); $cookie->bake; # now let's play with the content_type and other headers $q->content_type('text/plain'); $q->header_out('MyHeader' => 'MyValue'); # do other stuff return $content; } 1;This plugin helps to try and fix some of the annoyances of using CGI::Application in a pure mod_perl (1.0 or 2.0) environment (see INSTALLATION for specific issues regarding installation under mod_perl 2.x). CGI::Application assumes that you use CGI.pm, but I wanted to avoid it's bloat and have access to the performance of the Apache::* modules so along came this plugin. At the current moment it only does two things:Use Apache::Request as the $self->query object thus avoiding the creation of the CGI.pm object.Override the way CGI::Application creates and prints it's HTTP headers. Since it was using CGI.pm's header() and redirect() method's we needed an alternative. So now we use the Apache->send_http_header() method. This has a few additional benefits other than just not using CGI.pm. It means that we can use other Apache::* modules that might also create outgoing headers (e.g. Apache::Cookie) without CGI::Application clobbering them. Requirements: · Perl
CGI::Application::Plugin::Apache Related Software