perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: Apache::Util porting issues
Date Mon, 28 Jan 2002 08:07:11 GMT

>>but the 1.x API, doesn't have $r in the API. Can we have some global
>>variable that always points to the current pool? in the order r->pool,
>>s->pool, or pconf? This will solve many API adjustments problems. Or
>>s->is it a bad idea?
>>
> 
> we should avoid that whenever possible.  but we could change
> modperl_sv2pool to allow &PL_sv_undef which means use
> modperl_global_request_rec_get()->pool if available else
> modperl_global_get_pconf()

here is the patch.

Index: src/modules/perl/modperl_util.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v
retrieving revision 1.33
diff -u -r1.33 modperl_util.c
--- src/modules/perl/modperl_util.c     8 Jan 2002 01:29:23 -0000       1.33
+++ src/modules/perl/modperl_util.c     28 Jan 2002 08:01:35 -0000
@@ -174,6 +174,18 @@
      char *classname = NULL;
      IV ptr = 0;

+    /* get the pool from the current request if applicable */
+    if (obj == &PL_sv_undef) {
+        request_rec *r = NULL;
+        (void)modperl_tls_get_request_rec(&r);
+
+        if (r) {
+            return r->pool;
+        }
+
+        return NULL;
+    }
+
      if ((SvROK(obj) && (SvTYPE(SvRV(obj)) == SVt_PVMG))) {
          ptr = SvObjIV(obj);
          classname = SvCLASS(obj);


Shouldn't this:

     if (in == &PL_sv_undef) {
         return NULL;
     }

in modperl_xs_sv2request_rec() be removed too? This case is already 
handled in the third if() and allows for the same trick of getting onto 
the current request when passing undef.

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message