Philippe M. Chiasson wrote:
On Thu, 2004-02-12 at 14:03 -0800, Stas Bekman wrote:

Philippe M. Chiasson wrote:

On Wed, 2004-02-11 at 17:02 -0800, Stas Bekman wrote:


Doesn't save_item completely copy the original sv away and then restore it on the scope exit? For some reason it doesn't work (fails with 'insecure dependency on eval' error).

[...]


No, not really. When I originally wrote that piece of code, I was trying
to get it to work using save_item() only, and had to packpedal and
revert to this nastiness about dollar_zero_tainted..

As far as I can tell, save_item should work in that case.

That sounds like a perl bug to me. I may give it another try later.


If my memory serves me right, this problematic behaviour is linked with
some magic about $0, save_item() did work correctly with other less-
magical scalars...

This seems to be a much more maintainable solution. Do we care about performance in perldo?


Index: src/modules/perl/modperl_cmd.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
retrieving revision 1.56
diff -u -r1.56 modperl_cmd.c
--- src/modules/perl/modperl_cmd.c      12 Feb 2004 22:02:44 -0000      1.56
+++ src/modules/perl/modperl_cmd.c      14 Feb 2004 02:09:42 -0000
@@ -515,25 +515,8 @@
                           arg, NULL);
     }

-    {
-        /* Set $0 to the current configuration file */
-        SV *dollar_zero = get_sv("0", TRUE);
-        int dollar_zero_tainted = SvTAINTED(dollar_zero);
-
-        if (dollar_zero_tainted) {
-            SvTAINTED_off(dollar_zero);
-        }
-
-        ENTER;
-        save_item(dollar_zero);
-        sv_setpv(dollar_zero, directive->filename);
-        eval_pv(arg, FALSE);
-        LEAVE;
-
-        if (dollar_zero_tainted) {
-            SvTAINTED_on(dollar_zero);
-        }
-    }
+    eval_pv(apr_psprintf(p, "{ local $0 = q[%s]; %s }",
+                         directive->filename, arg), FALSE);

     if (SvTRUE(ERRSV)) {
         SV *strict = MP_STRICT_PERLSECTIONS_SV;

__________________________________________________________________
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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to