> hmm...
>
> I started to work on this but couldn't get it to fail as you describe.
> basically all I did was add code that looked for $ENV{MOD_PERL_API_VERSION}
> during config (<Perl> sections) and the open_logs and post_config phases
> (where you said you were having trouble) and I can see it every time.
>
> yeah, I can see that it's actually set during post_config, but I'm hesitant
> to shuffle things around if I can't actually reproduce the problem in the
> first place.
sorry, I meant to attach my test patch.
--Geoff
Index: t/hooks/TestHooks/startup.pm
===================================================================
--- t/hooks/TestHooks/startup.pm (revision 371539)
+++ t/hooks/TestHooks/startup.pm (working copy)
@@ -62,6 +62,11 @@
my $val = $s->dir_config->{PostConfig} or die "Can't read PostConfig var";
+ # make sure that these are set at the earliest possible time
+ die '$ENV{MOD_PERL} not set!' unless $ENV{MOD_PERL};
+ die '$ENV{MOD_PERL_API_VERSION} not set!'
+ unless $ENV{MOD_PERL_API_VERSION} == 2;
+
my $port = $s->port;
my $file = catfile $dir, "$phase-$port";
Index: t/conf/extra.last.conf.in
===================================================================
--- t/conf/extra.last.conf.in (revision 371539)
+++ t/conf/extra.last.conf.in (working copy)
@@ -67,6 +67,13 @@
$TestDirective::perl::base_server = Apache2::PerlSections->server;
</Perl>
+<Perl >
+# make sure that these are set at the earliest possible time
+die '$ENV{MOD_PERL} not set!' unless $ENV{MOD_PERL};
+die '$ENV{MOD_PERL_API_VERSION} not set!'
+ unless $ENV{MOD_PERL_API_VERSION} == 2;
+</Perl>
+
<VirtualHost perlsections>
<Perl >
$TestDirective::perl::vhost_server = Apache2::PerlSections->server;
Index: t/response/TestModperl/pnotes.pm
===================================================================
--- t/response/TestModperl/pnotes.pm (revision 371539)
+++ t/response/TestModperl/pnotes.pm (working copy)
@@ -4,6 +4,7 @@
use warnings FATAL => 'all';
use Apache2::RequestUtil ();
+use Apache2::ConnectionUtil ();
use Apache::Test;
use Apache::TestUtil;
@@ -11,39 +12,88 @@
use Apache2::Const -compile => 'OK';
sub handler {
+
my $r = shift;
- plan $r, tests => 9;
+ # make it ok to call ok() here while plan()ing elsewhere
+ Apache::Test::init_test_pm($r);
+ $Test::ntest = 1 + (22 * ($r->args - 1));
+ $Test::planned = 22;
- ok $r->pnotes;
+ my $c = $r->connection;
- ok t_cmp($r->pnotes('pnotes_foo', 'pnotes_bar'),
- 'pnotes_bar',
- q{$r->pnotes(key,val)});
+ # we call this handler 3 times.
+ # $r->pnotes('request') should be unset each time
+ # $c->pnotes('connection') should be unset the first
+ # time but set the second time due to the keepalive
+ # request. the second request then cleans up after
+ # itself, leaving $c->pnotes again unset at the
+ # start of the third request
+ if ($r->args == 2) {
+ ok t_cmp($c->pnotes('connection'),
+ 'CSET',
+ '$c->pnotes() persists across keepalive requests');
+ }
+ else {
+ t_debug('testing $c->pnotes is empty');
+ ok (! $c->pnotes('connection'));
+ }
- ok t_cmp($r->pnotes('pnotes_foo'),
- 'pnotes_bar',
- q{$r->pnotes(key)});
+ # $r->pnotes should be reset each time
+ t_debug('testing $r->pnotes is empty');
+ ok (! $r->pnotes('request'));
- ok t_cmp(ref($r->pnotes), 'HASH', q{ref($r->pnotes)});
+ foreach my $map ({type => 'r', object => $r},
+ {type => 'c', object => $c}) {
- ok t_cmp($r->pnotes()->{'pnotes_foo'}, 'pnotes_bar',
- q{$r->pnotes()->{}});
+ my $type = $map->{type};
- # unset the entry (but the entry remains with undef value)
- $r->pnotes('pnotes_foo', undef);
- ok t_cmp($r->pnotes('pnotes_foo'), undef,
- q{unset entry contents});
- my $exists = exists $r->pnotes->{'pnotes_foo'};
- $exists = 1 if $] < 5.008001; # changed in perl 5.8.1
- ok $exists;
+ my $o = $map->{object};
- # now delete completely (possible only via the hash inteface)
- delete $r->pnotes()->{'pnotes_foo'};
- ok t_cmp($r->pnotes('pnotes_foo'), undef,
- q{deleted entry contents});
- ok !exists $r->pnotes->{'pnotes_foo'};
+ t_debug("testing $type->pnotes call");
+ ok $o->pnotes;
+ ok t_cmp($o->pnotes('pnotes_foo', 'pnotes_bar'),
+ 'pnotes_bar',
+ "$type->pnotes(key,val)");
+
+ ok t_cmp($o->pnotes('pnotes_foo'),
+ 'pnotes_bar',
+ "$type->pnotes(key)");
+
+ ok t_cmp(ref($o->pnotes), 'HASH', "ref($type->pnotes)");
+
+ ok t_cmp($o->pnotes()->{'pnotes_foo'}, 'pnotes_bar',
+ "$type->pnotes()->{}");
+
+ # unset the entry (but the entry remains with undef value)
+ $o->pnotes('pnotes_foo', undef);
+ ok t_cmp($o->pnotes('pnotes_foo'), undef,
+ "unset $type contents");
+
+ my $exists = exists $o->pnotes->{'pnotes_foo'};
+ $exists = 1 if $] < 5.008001; # changed in perl 5.8.1
+ ok $exists;
+
+ # now delete completely (possible only via the hash inteface)
+ delete $o->pnotes()->{'pnotes_foo'};
+ ok t_cmp($o->pnotes('pnotes_foo'), undef,
+ "deleted $type contents");
+ ok !exists $o->pnotes->{'pnotes_foo'};
+ }
+
+ # set pnotes so we can test unset on later connections
+ $r->pnotes(request => 'RSET');
+ $c->pnotes(connection => 'CSET');
+
+ ok t_cmp($r->pnotes('request'),
+ 'RSET',
+ '$r->pnotes() set');
+
+ ok t_cmp($c->pnotes('connection'),
+ 'CSET',
+ '$c->pnotes() set');
+
Apache2::Const::OK;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]