MasonX-Apache2Handler
view release on metacpan or search on metacpan
diff/ApacheHandler.diff view on Meta::CPAN
use constant
- HAS_TABLE_API => $mod_perl::VERSION >= 1.99 || Apache::perl_hook('TableApi');
+ HAS_TABLE_API => $mod_perl::VERSION >= 1.99;
my %AH_BY_CONFIG;
sub make_ah
@@ -569,23 +588,34 @@
my %params = @_;
my %defaults;
- $defaults{request_class} = 'HTML::Mason::Request::ApacheHandler'
+ $defaults{request_class} = 'MasonX::Request::Apache2Handler'
unless exists $params{request};
- $defaults{resolver_class} = 'HTML::Mason::Resolver::File::ApacheHandler'
+ $defaults{resolver_class} = 'MasonX::Resolver::File::Apache2Handler'
unless exists $params{resolver};
my $allowed_params = $class->allowed_params(%defaults, %params);
- if ( exists $allowed_params->{comp_root} and
- my $req = $r || Apache->request ) # DocumentRoot is only available inside requests
+ if ( exists $allowed_params->{comp_root} and
+ my $req = $r ) # DocumentRoot is only available inside requests
{
$defaults{comp_root} = $req->document_root;
}
+=comment
+ if ( exists $allowed_params->{comp_root} ) {
+ if ( my $req = $r ) {
+ # DocumentRoot is only available inside requests
+ $defaults{comp_root} = $req->document_root;
+ } else {
+ $defaults{comp_root} =
+ Apache->server->dir_config( '_MasonDefaultDocumentRoot' );
+ }
+ }
+=cut
if (exists $allowed_params->{data_dir} and not exists $params{data_dir})
{
# constructs path to <server root>/mason
- my $def = $defaults{data_dir} = Apache->server_root_relative('mason');
+ my $def = $defaults{data_dir} = Apache->server->server_root_relative('mason');
param_error "Default data_dir (MasonDataDir) '$def' must be an absolute path"
unless File::Spec->file_name_is_absolute($def);
@@ -624,7 +654,7 @@
unless ( $self->interp->resolver->can('apache_request_to_comp_path') )
{
error "The resolver class your Interp object uses does not implement " .
- "the 'apache_request_to_comp_path' method. This means that ApacheHandler " .
+ "the 'apache_request_to_comp_path' method. This means that Apache2Handler " .
"cannot resolve requests. Are you using a handler.pl file created ".
"before version 1.10? Please see the handler.pl sample " .
"that comes with the latest version of Mason.";
@@ -633,7 +663,9 @@
# If we're running as superuser, change file ownership to http user & group
if (!($> || $<) && $self->interp->files_written)
{
- chown Apache->server->uid, Apache->server->gid, $self->interp->files_written
+ chown getpwnam( Apache->server->dir_config( '_MasonUser' ) ),
+ getgrnam( Apache->server->dir_config( '_MasonGroup' ) ),
+ $self->interp->files_written
or system_error( "Can't change ownership of files written by interp object: $!\n" );
}
@@ -684,8 +716,10 @@
}
return ["<center><h2>" . $self->apache_status_title . "</h2></center>" ,
- $self->status_as_html(apache_req => $r),
- $self->interp->status_as_html(ah => $self, apache_req => $r)];
+ $self->status_as_html
+ (apache_req => $r),
+ $self->interp->status_as_html
+ (ah => $self, $r) ];
};
local $^W = 0; # to avoid subroutine redefined warnings
Apache::Status->menu_item($status_name, $self->apache_status_title, $statsub);
@@ -700,7 +734,7 @@
if $interp->compiler->can('add_allowed_globals');
}
-# Generate HTML that describes ApacheHandler's current status.
+# Generate HTML that describes Apache2andler's current status.
# This is used in things like Apache::Status reports.
sub status_as_html {
@@ -709,7 +743,7 @@
# Should I be scared about this? =)
my $comp_source = <<'EOF';
-<h3>ApacheHandler properties:</h3>
+<h3>Apache2Handler properties:</h3>
<blockquote>
<tt>
<table width="75%">
@@ -762,7 +796,7 @@
</blockquote>
<%args>
- $ah # The ApacheHandler we'll elucidate
+ $ah # The Apache2Handler we'll elucidate
%valid # Contains default values for member data
</%args>
EOF
@@ -805,11 +839,9 @@
# Apache::Request object to a variable currently containing a
# plain Apache object, we leak memory. This means we'd have to
# use multiple variables to avoid this, which is annoying.
- my $r =
- $r_sub->( $self->args_method eq 'mod_perl' ?
- Apache::Request->instance( $_[0] ) :
- $_[0]
- );
+
+ # for mod_perl2 just pickup Apache::RequestRec
+ my $r = $_[0];
my $interp = $self->interp;
( run in 1.468 second using v1.01-cache-2.11-cpan-5511b514fd6 )