10 defined $ENV{MOD_PERL_API_VERSION} and $ENV{MOD_PERL_API_VERSION} >= 2
15 require Apache2::Const;
16 require Apache2::RequestRec;
17 require Apache2::RequestUtil;
18 require Apache2::RequestIO;
20 require Apache::Constants;
26 # mod_perl initializer: returns 0 on success, Apache error code on failure
30 $PLP::print = 'PLP::Apache::print';
33 $ENV{PLP_FILENAME} = my $filename = $r->filename;
35 unless (-f $filename) {
36 return MP2 ? Apache2::Const::HTTP_NOT_FOUND() : Apache::Constants::NOT_FOUND();
39 return MP2 ? Apache2::Const::HTTP_FORBIDDEN() : Apache::Constants::FORBIDDEN();
42 $ENV{PLP_NAME} = $r->uri;
44 $PLP::use_cache = $r->dir_config('PLPcache') !~ /^off$/i;
45 #S $PLP::use_safe = $r->dir_config('PLPsafe') =~ /^on$/i;
46 my $path = $r->filename();
47 my ($file, $dir) = File::Basename::fileparse($path);
50 $PLP::code = PLP::source($file, 0, undef, $path);
57 $r->read(my $data, $bytes);
61 # FAST printing under mod_perl
63 return unless grep length, @_;
64 PLP::sendheaders() unless $PLP::sentheaders;
68 # This is the mod_perl handler.
71 if (my $ret = init($_[0])) {
77 return MP2 ? Apache2::Const::OK() : Apache::Constants::OK();