perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
Subject Re: [patch] default request pool sub
Date Tue, 29 Jan 2002 17:45:36 GMT
Doug MacEachern wrote:

> On Wed, 30 Jan 2002, Stas Bekman wrote:
>>Sure, be it ModPerl::Util:: function. How should it be called? Can I use 
>>the same code I've used for APR::Pool::from_current_request() in my orig 
> ModPerl::Util::default_pool();

so as you say below, we don't need this function for now.

>>Take the case of the Apache::Util::ht_time wrapper. We cannot use 
>>Apache->request->pool without fallback, since we don't know where it's 
>>used. So I prefer to have one function that returns some pool for sure 
>>to be used in all wrappers needing this functionality. Rather than 
>>trying Apache->request->pool and falling back to pconf in every compat 
>>wrapper we need a poll.
> in this case, if ht_time is used at request time without
> PerlOptions +GlobalRequest, then all calls to ht_time leak into pconf.
> it is also unsafe to use pconf at request time with threaded MPMs.

That's clear.

> i doubt anybody is using ht_time() at startup.  i think it would be best
> to start out using Apache->request->pool here.  maybe adding this in
> instead of ModPerl::Util::default_pool():
> sub default_pool {
>     my $r = Apache->request;
>     die "need to configure 'PerlOptions +GlobalRequest'" unless $r;
>     return $r->pool;
> }
> after all, this function should only be used for compat wrappers.

Fine with me. So you say that we "assume" that nobody uses functions 
that in 2.0 require a pool arg, outside of request phases. And if 
somebody does use any of these functions during the startup, we will 
deal with that when the time comes.

BTW, we need to add another die() above, in case that the function is 
used at the startup. How do you say this in Perl?

sub default_pool {
      die "Can be used only during request" unless ???
      my $r = Apache->request;
      die "need to configure 'PerlOptions +GlobalRequest'" unless $r;
      return $r->pool;

Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker      mod_perl Guide

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message