Author: gozer Date: Wed Nov 16 15:53:01 2005 New Revision: 345151 URL: http://svn.apache.org/viewcvs?rev=345151&view=rev Log: Calling Apache2::ServerUtil->server in <Perl> sections now returns the server into which the <Perl> section was defined
Modified: perl/modperl/trunk/Changes perl/modperl/trunk/src/modules/perl/modperl_cmd.c perl/modperl/trunk/t/conf/extra.last.conf.in perl/modperl/trunk/t/hooks/TestHooks/push_handlers_anon.pm perl/modperl/trunk/t/response/TestDirective/perldo.pm Modified: perl/modperl/trunk/Changes URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=345151&r1=345150&r2=345151&view=diff ============================================================================== --- perl/modperl/trunk/Changes (original) +++ perl/modperl/trunk/Changes Wed Nov 16 15:53:01 2005 @@ -12,6 +12,10 @@ =item 2.0.3-dev +Calling Apache2::ServerUtil->server in <Perl> sections now +returns the server into which the <Perl> section was defined +[Gozer] + Require B::Size and B::TerseSize v0.06 for Apache2::Status options StatusTerse and StatusTerseSize which has now been updated to support the new mod_perl2 api post RC5. Modified: perl/modperl/trunk/src/modules/perl/modperl_cmd.c URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_cmd.c?rev=345151&r1=345150&r2=345151&view=diff ============================================================================== --- perl/modperl/trunk/src/modules/perl/modperl_cmd.c (original) +++ perl/modperl/trunk/src/modules/perl/modperl_cmd.c Wed Nov 16 15:53:01 2005 @@ -550,6 +550,7 @@ } { + server_rec *old_s = modperl_global_get_server_rec(); SV *code = newSVpv(arg, 0); GV *gv = gv_fetchpv("0", TRUE, SVt_PV); ENTER;SAVETMPS; @@ -557,9 +558,11 @@ #if PERL_REVISION == 5 && PERL_VERSION >= 9 TAINT_NOT; /* XXX: temp workaround, see my p5p post */ #endif + modperl_global_set_server_rec(s); sv_setpv_mg(GvSV(gv), directive->filename); eval_sv(code, G_SCALAR|G_KEEPERR); SvREFCNT_dec(code); + modperl_global_set_server_rec(old_s); modperl_env_sync_srv_env_hash2table(aTHX_ p, scfg); modperl_env_sync_dir_env_hash2table(aTHX_ p, dcfg); FREETMPS;LEAVE; Modified: perl/modperl/trunk/t/conf/extra.last.conf.in URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/conf/extra.last.conf.in?rev=345151&r1=345150&r2=345151&view=diff ============================================================================== --- perl/modperl/trunk/t/conf/extra.last.conf.in (original) +++ perl/modperl/trunk/t/conf/extra.last.conf.in Wed Nov 16 15:53:01 2005 @@ -63,6 +63,16 @@ } </Perl> +<Perl > +$TestDirective::perl::base_server = Apache2::ServerUtil->server; +</Perl> + +<VirtualHost perlsections> + <Perl > + $TestDirective::perl::vhost_server = Apache2::ServerUtil->server; + </Perl> +</VirtualHost> + ### --------------------------------- ### Perl $TestDirective::perl::worked="yes"; Modified: perl/modperl/trunk/t/hooks/TestHooks/push_handlers_anon.pm URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/hooks/TestHooks/push_handlers_anon.pm?rev=345151&r1=345150&r2=345151&view=diff ============================================================================== --- perl/modperl/trunk/t/hooks/TestHooks/push_handlers_anon.pm (original) +++ perl/modperl/trunk/t/hooks/TestHooks/push_handlers_anon.pm Wed Nov 16 15:53:01 2005 @@ -44,23 +44,13 @@ <VirtualHost TestHooks::push_handlers_anon> PerlModule TestHooks::push_handlers_anon <Perl > - # want to push a handler for a vhost, via $s, but the only way to - # get $s for vhost is to traverse the vhosts list - use Apache::Test; - use Apache::TestRequest; - Apache::TestRequest::module('TestHooks::push_handlers_anon'); - my $hostport = Apache::TestRequest::hostport(Apache::Test::config()); - my ($host, $port) = split ':', $hostport; my $s = Apache2::ServerUtil->server; - my $vs = $s->next; - for (; $vs; $vs = $vs->next) { - last if $port == $vs->port - } - $vs->push_handlers(PerlFixupHandler => + + $s->push_handlers(PerlFixupHandler => sub { &TestHooks::push_handlers_anon::add_note }); - $vs->push_handlers(PerlFixupHandler => + $s->push_handlers(PerlFixupHandler => \&TestHooks::push_handlers_anon::add_note ); - $vs->push_handlers(PerlFixupHandler => + $s->push_handlers(PerlFixupHandler => "TestHooks::push_handlers_anon::add_note" ); </Perl> Modified: perl/modperl/trunk/t/response/TestDirective/perldo.pm URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestDirective/perldo.pm?rev=345151&r1=345150&r2=345151&view=diff ============================================================================== --- perl/modperl/trunk/t/response/TestDirective/perldo.pm (original) +++ perl/modperl/trunk/t/response/TestDirective/perldo.pm Wed Nov 16 15:53:01 2005 @@ -11,7 +11,7 @@ sub handler { my $r = shift; - plan $r, tests => 16; + plan $r, tests => 17; ok t_cmp('yes', $TestDirective::perl::worked); @@ -52,7 +52,12 @@ ok t_cmp($@, "", "PerlSections dump syntax check"); ok t_cmp($TestDirective::perldo::test::Include, qr/perlsection.conf/); - + + #Check for correct Apache2::ServerUtil->server behavior + my $bport = $TestDirective::perl::base_server->port; + my $vport = $TestDirective::perl::vhost_server->port; + ok defined $bport && defined $vport && $vport != $bport; + Apache2::Const::OK; }