Stas Bekman a écrit :
Arnaud Blancher wrote:
Stas Bekman a écrit :
ydnar wrote:
The eval() is unecessary. The named sub can be used:
&$func();
yes but not with use strict ...
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 !!!!
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'.
Thanks Arnaud.
FWIW, I find $func->() to be a more readable syntax.
You don't need to load anything. Indeed under mp2:
*CORE::GLOBAL::exit = \&ModPerl::Util::exit;
And you don't need to load anything for this to work.
in mp2 exit is implemented via a special die() call, therefore if you call it inside eval { } block (and eval "STRING" behaves identically) an exception is being thrown, but caught by eval.
for me, both solution don't work :-(( maybe me installation is wrong ... the output is always the sum of &first &second
You mean one solution. Indeed, I tried it and it doesn't, since $@ is set to '', which is the same as if eval {} didn't die.
You didn't try the second solution: CORE::exit(0), but you probably don't want to use it as it's not efficient. But it'll work exactly as mod_cgi does.
I consider the inability to exit when called from eval as a problem, so we need to think of finding a better way to emulate exit-but-don't-exit functionality.
-- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html