You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apreq-dev@httpd.apache.org by Randy Kobes <ra...@theoryx5.uwinnipeg.ca> on 2003/11/02 08:38:55 UTC

Re: cvs commit: httpd-apreq-2/build xsbuilder.pl

On Fri, 31 Oct 2003, Joe Schaefer wrote:

> Randy Kobes <ra...@theoryx5.uwinnipeg.ca> writes:
>
> [...]
>
> > Until things are arranged so that all the needed APR::* can
> > be used outside of mp2, I've been looking at the perl glue
> > in a CGI context, just to see what's involved. This entails
> > having available mod_perl.so as an so/dll. Although this may
> > not be the best model, I tried the following, just to see if
> > it works:
>
> Cool.
>
> > - make an Apreq::Base, consisting of a Base.xs that just
> > made available apr_initialize() and apr_terminate2().
> > - make an Apreq::Request which loads Apreq::Base and has
> > a new() method to create an Apreq::Request object by
> >     - calling apr_initialize()
> >     - creating a $p = APR::Pool->new()
> >     - creating a $req = Apache::Request->new($p, @_)
> > - make an Apreq::Cookie which similarly passes a $p pool
> > in as the $env within Apache/Cookie.pm.
> > - I'm not sure about this, but I also made a DESTROY sub
> > which calls apr_terminate2().
>
> initialize/terminate are per-process events, so calling them
> from the object ctor/dtor is probably a mistake.  IMO those calls
> probably belong inside BEGIN and END blocks within APR.pm.
> If that were so, Base.xs would be unnecessary, right?

I know this can wait until the next development cycle, but
just to record this ... For some reason just using APR.pm to
call apr_initialize/apr_terminate (through APR.xs) doesn't
seem to work for the CGI environment, and yet putting the
same code in an Apreq/Base.xs:
================================================================
BOOT:
     apr_initialize();

void
END()

   CODE:
   apr_terminate2();
================================================================
does work. I'll look into this some more ...

-- 
best regards,
randy

Re: cvs commit: httpd-apreq-2/build xsbuilder.pl

Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
[...]
> I know this can wait until the next development cycle, but
> just to record this ... For some reason just using APR.pm to
> call apr_initialize/apr_terminate (through APR.xs) doesn't
> seem to work for the CGI environment, and yet putting the
> same code in an Apreq/Base.xs:
> ================================================================
> BOOT:
>      apr_initialize();
> 
> void
> END()
> 
>    CODE:
>    apr_terminate2();
> ================================================================
> does work. I'll look into this some more ...

If you copy this from APR.xs, make sure to copy the whole BOOT. apr_initialize 
has a bug in its init, which is worked around in APR.xs.


__________________________________________________________________
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