X-Git-Url: http://git.shiar.net/perl/plp/.git/blobdiff_plain/58286f44f06df2a424e09f50312616b96832b30d..68a18bf55edfd520ec9853550b6d718bfb272788:/PLP/Apache.pm diff --git a/PLP/Apache.pm b/PLP/Apache.pm index c388095..5a9745c 100644 --- a/PLP/Apache.pm +++ b/PLP/Apache.pm @@ -21,11 +21,14 @@ BEGIN { } } +our $r; + # mod_perl initializer: returns 0 on success, Apache error code on failure sub init { - our $r = shift; + $r = shift; $PLP::print = 'PLP::Apache::print'; + $PLP::read = \&read; $ENV{PLP_FILENAME} = my $filename = $r->filename; @@ -38,8 +41,8 @@ sub init { $ENV{PLP_NAME} = $r->uri; - our $use_cache = $r->dir_config('PLPcache') !~ /^off$/i; -#S our $use_safe = $r->dir_config('PLPsafe') =~ /^on$/i; + $PLP::use_cache = $r->dir_config('PLPcache') !~ /^off$/i; +#S $PLP::use_safe = $r->dir_config('PLPsafe') =~ /^on$/i; my $path = $r->filename(); my ($file, $dir) = File::Basename::fileparse($path); chdir $dir; @@ -49,11 +52,17 @@ sub init { return 0; # OK } +sub read ($) { + my ($bytes) = @_; + $r->read(my $data, $bytes); + return $data; +} + # FAST printing under mod_perl sub print { return unless grep length, @_; PLP::sendheaders() unless $PLP::sentheaders; - $PLP::Apache::r->print(@_); + $r->print(@_); } # This is the mod_perl handler.