Some time ago, someone had a problem with a segfault when using Safe.pm, back then I wrote this patch. Perhaps it shouldn't go in as is, and we should just document that Safe.pm doesn't work with mod_perl, but this part is probably crucial:

-       CV *cv = GvCV(gv_fetchpv("Apache::write_client", FALSE, SVt_PVCV));
+        /* should exist already */
+        CV *cv = GvCV(gv_fetchpv("Apache::write_client", GV_ADDWARN, SVt_PVCV))

I think it was Tim Bunce who suggested me to s/FALSE/GV_ADDWARN/. It doesn't add any overhead, but if gv_fetchpv fails and GV_ADDWARN is on, it'll log a warning, which a user can use to debug what the problem is.

Index: src/modules/perl/Apache.xs
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v
retrieving revision 1.128
diff -u -r1.128 Apache.xs
--- src/modules/perl/Apache.xs  6 Jul 2003 04:51:20 -0000       1.128
+++ src/modules/perl/Apache.xs  30 Aug 2003 02:26:31 -0000
@@ -1134,7 +1134,9 @@
        sv_setiv(sendh, 0);
     }
     else {
-       CV *cv = GvCV(gv_fetchpv("Apache::write_client", FALSE, SVt_PVCV));
+        /* should exist already */
+        CV *cv = GvCV(gv_fetchpv("Apache::write_client", GV_ADDWARN, SVt_PVCV))
;
+        if(!cv) croak("can't find Apache::write_client, are you using Safe.pm?"
);
        soft_timeout("mod_perl: Apache->print", r);
        PUSHMARK(mark);
 #ifdef PERL_OBJECT


__________________________________________________________________ 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