perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <go...@cpan.org>
Subject Re: [mp1 patch] gv_fetchpv "Apache::write_client",
Date Fri, 03 Oct 2003 18:13:21 GMT
If this is a good idea, then shouldn't we also do it in the only other
place where we gv_fetchpv("",FALSE, ...) ?

Index: src/modules/perl/perlio.c
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/perlio.c,v
retrieving revision 1.9
diff -u -I$Id: -r1.9 perlio.c
--- src/modules/perl/perlio.c   24 Mar 2002 02:17:10 -0000      1.9
+++ src/modules/perl/perlio.c   3 Oct 2003 18:10:07 -0000
@@ -108,7 +108,7 @@
     Sfdisc_t*       disc;   /* discipline */
 {
     /* feed buffer to Apache->print */
-    CV *cv = GvCV(gv_fetchpv("Apache::print", FALSE, SVt_PVCV));
+    CV *cv = GvCV(gv_fetchpv("Apache::print", GV_ADDWARN, SVt_PVCV));
     dSP;
     ENTER;
     SAVETMPS;


On Fri, 2003-08-29 at 20:08, Stas Bekman wrote:
> 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:stas@stason.org http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
> For additional commands, e-mail: dev-help@perl.apache.org
> 
> 

Mime
View raw message