hi all...
ok, here is a first pass on APR::Pool::DESTROY.
what basically happens here is that DESTROY only calls apr_pool_destroy if the object on which it is invoked contains magic. so
my $p = APR::Pool->new; $p->DESTROY;
calls apr_pool_destroy, while
my $p = $r->pool; $p->DESTROY;
does not. in either case
$p->destroy;
still works, destroying the pool with no checks whatsoever.
nice
in order to add magic to APR::Pool->new() based objects, I had to pull a few tricks. to avoid messing with the existing typemaps (which wouldn't work anyway) and the majority of the autogeneration code, what I ended up doing was adding an additional parameter to apr_functions.map. the additional parameter, if present, represents a function to place in a CLEANUP section in WrapXS. this allows the current autogenerated code to keep on working, while allowing me to manipulate the object just before it is returned to perl-space.
OK, if setting magic requires tricks, why not use apr_pool_userdata_set in mpxs_apr_pool_create for destroy-able objects?
I used '~' because that's what modperl_filter uses, which I assumed was a single character for performance reasons. we can always use something else, but I didn't think using identical flags would collide in this instance.
'~' is just a general purpose custom magic type, see perlguts (search for PERL_MAGIC_ext)
anyway, attached is the patch in full. as I said, it's only a first pass, but it seems to work and is relatively clean. adding the ability to set CLEANUP sections may be geniuinely useful if we need to do stuff like this in the future, so I thought it was as good an approach as any.
If this goes in, we probably need to sync with Gerald, since the plan was to have ExtUtils::WrapXS to replace the current internal implementation when the external one is completed.
__________________________________________________________________ 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]
