perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Vanasco <...@2xlp.com>
Subject Re: Apache::RequestRec outside of handler?
Date Wed, 31 May 2006 21:53:42 GMT

On May 31, 2006, at 5:35 PM, Philip M. Gollucci wrote:

> Jonathan Vanasco wrote:
>> I'm guessing/hoping that this just stores a hashref to the current  
>> request object?
> Not exactly.  It stores a global object.  Which is why this is SLOW  
> in threads because it has to CLONE() it between them.

argh...

a- isn't threaded mod_perl 1 thread per request?  or is there some  
other threading going on that makes this super undesirable
b- for my use ( really just accessing some stuff like remote_ip and  
other connection methods when i don't have a $r handy ) it looks like  
i'd be better off with creating a namespace and storing a ref to $r  
at the start of each request, and resetting with a cleanup.  am i  
right?  (see below)

package p2xlp::ApacheHelper;
my $r;
sub set_r {
	my ( $ref ) = @_;
	$r= $ref;
}
sub get_r{
	return $r;
}
sub reset_r{
	$r= undef;
}
1;

package myApp;
sub handler{
	my $r= shift;
	&p2xlp::ApacheHelper::set_r( $r )
}
sub cleanup{
	&p2xlp::ApacheHelper::reset_r()
}
1;




| - - - - - - - - - - - - - - - - - - - -
| RoadSound.com / Indie-Rock.net
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - -





Mime
View raw message