[LON-CAPA-dev] [Fwd: eval inside of reval inside of modperl, and $@]
Gerd Kortemeyer
lon-capa-dev@mail.lon-capa.org
Mon, 08 Jul 2002 12:31:44 -0400
This is a multi-part message in MIME format.
--------------475BB9FFF0C37ADC701D3D5D
Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="4D4F5353"
Content-Transfer-Encoding: 7bit
I had also sent this to the modperl mailing list, but got no replies ...
$@%@#!!!
--------------475BB9FFF0C37ADC701D3D5D
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Return-Path: <modperl-return-26978-korte=lite.msu.edu@perl.apache.org>
Received: from apache.org (daedalus.apache.org [63.251.56.142])
by s16.lite.msu.edu (8.11.6/8.11.6) with SMTP id g66HVWm21771
for <korte@lite.msu.edu>; Sat, 6 Jul 2002 13:31:32 -0400
Received: (qmail 62367 invoked by uid 500); 6 Jul 2002 17:30:56 -0000
Mailing-List: contact modperl-help@apache.org; run by ezmlm
Precedence: bulk
list-help: <mailto:modperl-help@perl.apache.org>
list-unsubscribe: <mailto:modperl-unsubscribe@perl.apache.org>
list-post: <mailto:modperl@apache.org>
Delivered-To: mailing list modperl@perl.apache.org
Received: (qmail 62354 invoked from network); 6 Jul 2002 17:30:56 -0000
Message-ID: <3D27295A.7BE2DCB6@lite.msu.edu>
Date: Sat, 06 Jul 2002 13:31:07 -0400
From: Gerd Kortemeyer <korte@lite.msu.edu>
X-Mailer: Mozilla 4.77C-CCK-MCD {C-UDP; EBM-APPLE} (Macintosh; U; PPC)
X-Accept-Language: en
MIME-Version: 1.0
To: modperl@perl.apache.org
Subject: eval inside of reval inside of modperl, and $@
Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="4D4F5353"
Content-Transfer-Encoding: 7bit
X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N
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.
--------------475BB9FFF0C37ADC701D3D5D--