Hi,
I might be totally confusing myself, but I do have problems with the $@
variable inside of a Safe compartment inside of an Apache modperl
module.
The following subroutine returns "Oops Illegal division by zero ..."
when called from a standalone program, and "No problem" when called
inside a modperl module:
sub initsheet {
my $safeeval = new Safe(shift);
$safeeval->permit("entereval");
$safeeval->share('$@');
my $stuff=(<<'ENDSTUFF');
my $a=5;
my $b=0;
my $c=eval '$a/$b';
if ($@) {
return 'Oops '.$@;
} else {
return 'No problem!';
}
ENDSTUFF
return $safeeval->reval($stuff);
}
In spite of the division by zero in the $c=eval ... statement, $@ is not
set when inside of modperl.
BTW, the $safeeval->share('$@') was necessary to get this to work at
all, even as standalone. Now, maybe I need to share something else when
inside modperl?
Anybody any ideas what's going on?
THANKS!
- Gerd.