HI Stas,
this has its problems too. It dumps core. After starting a server I see:
Apache::Server::DESTROY
lookup_method finds APR::Pool. And so we call
APR::Pool::DESTROY
this does not look wrong to me, if APR::Pool has a DESTROY function and
Apache::Server isa APR::Pool.
here a small part from my coredump.
(gdb) bt
#0 0x40135abe in find_entry (ht=0x80baeb0, key=0x406cf229, klen=14, val=0x0)
at apr_hash.c:278
#1 0x40135c58 in apr_hash_get (ht=0x80baeb0, key=0x406cf229, klen=-1)
at apr_hash.c:340
#2 0x40143d4d in apr_pool_userdata_get (data=0xbfffe858,
key=0x406cf229 "APR::Pool::new", pool=0x2) at apr_pools.c:1879
#3 0x406ce7a8 in XS_APR__Pool_DESTROY ()
from
/home/ptest2/lib/perl5/site_perl/5.8.1/i686-linux-thread-multi/auto/APR/Pool/Pool.so
#4 0x4042c3b9 in Perl_pp_goto ()
from /home/ptest2/lib/perl5/5.8.1/i686-linux-thread-multi/CORE/libperl.so
#5 0x403f803e in Perl_runops_standard ()
and some typos fixed in the test ModPerl::EazyLife.
Am Dienstag, 17. Februar 2004 03:12 schrieb Stas Bekman:
> Stas Bekman wrote:
> [...]
>
> > really, I think it should always be only one matching module, since we
> > have no internal sub-classing at the moment.
>
> Something like so:
>
> package ModPerl::EazyLife;
>
> use ModPerl::MethodLookup ();
> use Carp;
>
> my @avail_modules = ModPerl::MethodLookup::avail_modules();
> push @avail_modules, 'Apache'; # XXX: may go away
> my $skip = qr|(::)?DESTROY$|;
> for my $module (@avail_modules) {
> *{"$module\::AUTOLOAD"} = sub {
> my($hint, @modules) =
> ModPerl::MethodLookup::lookup_method($AUTOLOAD, @_);
>
> # there should be only one match
> if (my $module = @modules) {
- if (my $module = @modules) {
+ if (my ($module) = @modules) {
> eval "require $module";
> # use the function from the module that we have just loaded
> $AUTOLOAD =~ s/.*::/$module::/;
- $AUTOLOAD =~ s/.*::/$module::/;
+ $AUTOLOAD =~ s/.*::/${module}::/;
> goto &$AUTOLOAD;
> }
> else {
> return if $AUTOLOAD =~ /$skip/;
> croak $hint || "Can't find $AUTOLOAD";
> }
> };
> }
>
> 1;
--
Boris
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]