ydnar wrote:
The eval() is unecessary. The named sub can be used:

&$func();

mod_perl remaps exit() to ModPerl::Util::exit(). Are you sure the right modules are being loaded?

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.

So in your case you either need to rethrow it:

use ModPerl::Util qw(exit);
my $func  = 'first';
eval "\&$func";
exit if $@;
&second();

or use the CORE::exit:

sub first {
  ...
  CORE::exit(0);
}

the problem with the latter is that it kills the process (or the interpreter if under threads), but it'll behave like mod_cgi and work the same under mod_cgi.

So choose your poison.

Also you can write your own exit function which will do what you want if neither of the two is satisfactory.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

--
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



Reply via email to