perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
Subject Re: [MP2] eval and exit(0) : problem
Date Mon, 03 May 2004 17:34:05 GMT
Arnaud Blancher wrote:
>> try:
>>   {
>>     no strict 'refs';
>>     &$func();
>>   }
> yes, it's work.
> i'don't realy like this solution, just because i always  try to use 'use 
> strict'
> to avoid problem with mod_perl !!!!

But in this case, it disables strict refs only for a very small scope! It 
doesn't affect anything else, so you perfectly fine.

> so, could you tell me if the final mp2, will have a solution for exit in 
> eval function ?
> in this case i'll wait and keep my complete 'use strict'
> in the other case .. may be i will change all my script, and lost a part 
> of 'strict'.

I have a working solution (haven't committed yet), but I'm not 100% sure yet 
that it's going to stay, I have received no feedback so far on this proposal [1].

At the moment looks like:

use ModPerl::Const -compile => 'EXIT';

eval {
      my $whatever = 1;
exit if $@ && ref $@ && $@ == ModPerl::EXIT;

The same will work for eval $string.

What happens here is that exit calls die with an exception object, which you 
can observe outside the eval block (the numerical context of $@ will return 
ModPerl::EXIT value) and rethrow exit (or do return or else) to cleanly quit 
the handler w/o killing the process.

If you wish, you can get the current cvs, apply my patch [1] and try the 
thing. You can see t/response/TestModperl/ which exercises this 


Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker     mod_perl Guide --->

Report problems:
Mail list info:
List etiquette:

View raw message