Dominique Quatravaux wrote:
Any chance you could add a test to the modperl2 test suite that I can reproduce the problem with?


I finally got around to doing that, sorry for the delay. Here is a new
test case, with inspiration from TestHooks::inlined_handlers.

Warning: since Apache->server->push_handlers() needs to operate at the
global server-config level, once this patch is applied, the *entire*
test suite mostly stops working :-] However, I am confident that once
the bug is gone this patch will no longer be intrusive, because when I
un-inline the sub (there is a commented-out line to that effect in the
test case file), the test suite passes correctly as a whole.

Dominique, your test case had a bug, fixed as following:

- sub { test_waz_zere });
+ sub { &test_waz_zere });

or  sub { test_waz_zere(@_) });

also I did some updates for the recent changes in mp2 API, the whole test is at 
the end.

Now with threaded perl 5.8.6 everything works fine, but:
t/directive/perlrequire fails with: can't find ANONSUB top entry (get)

with non-threaded 5.6.1 a bunch of tests fail with:
Undefined subroutine &main::ÿÿÿÿÿÿÿÿÿÿÿÿÿ called, <DATA> line 462.

so I'll be looking at those cases.

Thanks for the test case!

package TestHooks::inlined_handlers_server_wide;

# this test exercises Apache handlers as anonymous subs, installed
# using Apache->server->push_handlers() at mod_perl initialization
# time.
# Previously there was a refcounting bug there, similar to the
# one described in inlined_handlers.pm

use strict;
use warnings FATAL => 'all';

use Apache2::RequestIO ();
use Apache2::ServerUtil ();
use Apache2::Const -compile => qw(OK DECLINED);

our $answer = "not ok 1\n";

sub test_waz_zere {
   my ($r) = @_;
   $r->notes->set("test_waz_zere", 1);
   Apache2::Const::DECLINED;
}

BEGIN { if ($ENV{MOD_PERL}) {
## This works (non-inlined handler):
# Apache2->server->push_handlers(PerlFixupHandler => \&test_waz_zere );
## This did not work as of Subversion r159573:
Apache2::ServerUtil->server->push_handlers(PerlFixupHandler => sub { test_waz_zere(@_) });
} }


sub handler {
   my $r = shift;

   $r->print("1..1\n");
   $r->print($r->notes->get("test_waz_zere") ? "ok 1\n" :
            "not ok 1\n");
   Apache2::Const::OK;
}

1;
__DATA__
<NoAutoConfig>
   PerlModule TestHooks::inlined_handlers_server_wide
 <Location /TestHooks__inlined_handlers_server_wide>
     SetHandler modperl
     PerlResponseHandler TestHooks::inlined_handlers_server_wide
 </Location>
</NoAutoConfig>


--
__________________________________________________________________
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

Reply via email to