You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2001/12/12 18:15:12 UTC

porting Apache->gensym

I need Apache->gensym (actually I need the C function modperl_gensym), I 
wanted to port it from 1.x but todo says:

Apache->gensym:
 >> Apache::compat ?

we don't need it anymore? I know we don't need it for the Perl side, but 
we do need it for the C side.

This is a slightly adjusted copy from 1.x. Should it be named 
modperl_perl_gensym?

In any case, while I'm at it, I'd rather complete this todo item. So 
should I just use Symbol::gensym in compat.pm?

--- src/modules/perl/modperl_util.c	2001/11/19 23:24:46	1.31
+++ src/modules/perl/modperl_util.c	2001/12/12 17:10:11
@@ -572,3 +572,13 @@
  {
      return gv_stashpv(name, FALSE) ? 1 : 0;
  }
+
+/* same as Symbol::gensym() */
+SV *modperl_gensym(pTHX_ char *pack)
+{
+    GV *gv = newGVgen(pack);
+    SV *rv = newRV((SV*)gv);
+    (void)hv_delete(gv_stashpv(pack, TRUE),
+                    GvNAME(gv), GvNAMELEN(gv), G_DISCARD);
+    return rv;
+}
Index: src/modules/perl/modperl_util.h
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v
retrieving revision 1.30
diff -u -r1.30 modperl_util.h
--- src/modules/perl/modperl_util.h	2001/11/06 18:39:41	1.30
+++ src/modules/perl/modperl_util.h	2001/12/12 17:10:11
@@ -112,4 +112,6 @@

  MP_INLINE int modperl_perl_module_loaded(pTHX_ const char *name);

+SV *modperl_gensym(pTHX_ char *pack);
+
  #endif /* MODPERL_UTIL_H */


_____________________________________________________________________
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


Re: porting Apache->gensym

Posted by Doug MacEachern <do...@covalent.net>.
On Thu, 13 Dec 2001, Stas Bekman wrote:

> I need Apache->gensym (actually I need the C function modperl_gensym), I 
> wanted to port it from 1.x but todo says:
> 
> Apache->gensym:
>  >> Apache::compat ?
> 
> we don't need it anymore? I know we don't need it for the Perl side, but 
> we do need it for the C side.

sure, if we need it, +1.
 
> This is a slightly adjusted copy from 1.x. Should it be named 
> modperl_perl_gensym?

yeah.
 
> In any case, while I'm at it, I'd rather complete this todo item. So 
> should I just use Symbol::gensym in compat.pm?

sounds good.



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