perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <>
Subject Re: Interpreter scope
Date Mon, 23 Apr 2007 05:08:26 GMT
On 28-Feb-07, at 2:04 AM, Torsten Foertsch wrote:
> Hi,
> the default interpreter scope is request. That means a certain  
> interpreter is
> locked during the whole request cycle.

That's correct.

> I use modperl mostly in the
> pre-response phases plus sometimes as an output filter. But I use  
> pnotes to
> pass data between the phases. If I understand it correctly this  
> forbids a
> handler interpreter scope.

Yes, but you could use $r->notes() instead, as that's Perl agnostic,  
as long
as what you need to pass around can be serialized as a string, you  
should be

> Now I'd like to release the interpreter in most
> cases just before the response phase. So it can be reused by  
> another request
> while the current request sends its data over a possibly slow network.
> Is that reasonable?

It's certainly not unreasonable ;-) If you know what you are doing,  
it should
be perfectly fine to have a mechanism to release the current  
interpreter, and
in the worst-case scenario, it might just need to be re-acquired.

> Is there something like $r->release_interp_after_this_phase()?

Nope, but writing one would be very simple, all that's needed is
to call


> If not what is the right place to start looking/patching? And what  
> pitfalls
> are there to watch out?

The tricky case will be what happens if you release the interpreter, but
by some mistake, there is a handler that needs Perl again later during
the request phase, you'd have to handle that gracefully somewhat.

Philippe M. Chiasson     GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5       m/gozer\@(apache|cpan|ectoplasm)\.org/

View raw message