Author: joes Date: Tue Mar 8 13:22:57 2005 New Revision: 156569 URL: http://svn.apache.org/viewcvs?view=rev&rev=156569 Log: Fix the ModPerl-Registry/t tests.
Modified: perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/304.pl perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/ithreads_io_n_tie.pl perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/redirect-cookie.pl perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/redirect.pl perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/runtime_error_n_status_change.pl perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/special_blocks.pl perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/status_change.pl perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/conf/extra.conf.in perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/conf/modperl_extra_startup.pl Modified: perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/304.pl URL: http://svn.apache.org/viewcvs/perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/304.pl?view=diff&r1=156568&r2=156569 ============================================================================== --- perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/304.pl (original) +++ perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/304.pl Tue Mar 8 13:22:57 2005 @@ -4,12 +4,12 @@ # manually handle 'If-Modified-Since' requests use APR::Date (); -use Apache::Util (); -use Apache::RequestRec (); +use Apache2::Util (); +use Apache2::RequestRec (); use constant FMT => '%a, %d %b %Y %H:%M:%S %Z'; use constant GMT => 1; -use Apache::Const -compile => qw(HTTP_NOT_MODIFIED); +use Apache2::Const -compile => qw(HTTP_NOT_MODIFIED); my $last_modified = "Sun, 29 Oct 2000 15:43:29 GMT"; @@ -30,11 +30,11 @@ #warn "if_modified_since_secs $if_modified_since_secs\n\n"; if ($last_modified_secs < $if_modified_since_secs) { - $status = Apache::HTTP_NOT_MODIFIED; + $status = Apache2::HTTP_NOT_MODIFIED; $body = ''; } -my $date = Apache::Util::ht_time($r->pool, $r->request_time, FMT, GMT); +my $date = Apache2::Util::ht_time($r->pool, $r->request_time, FMT, GMT); print <<HEADERS; Status: $status Modified: perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/ithreads_io_n_tie.pl URL: http://svn.apache.org/viewcvs/perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/ithreads_io_n_tie.pl?view=diff&r1=156568&r2=156569 ============================================================================== --- perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/ithreads_io_n_tie.pl (original) +++ perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/ithreads_io_n_tie.pl Tue Mar 8 13:22:57 2005 @@ -3,19 +3,19 @@ # # there is a problem when STDOUT is internally opened to an -# Apache::PerlIO layer is cloned on a new thread start. PerlIO_clone +# Apache2::PerlIO layer is cloned on a new thread start. PerlIO_clone # in perl_clone() is called too early, before PL_defstash is # cloned. As PerlIO_clone calls PerlIOApache_getarg, which calls # gv_fetchpv via sv_setref_pv and boom the segfault happens. # # at the moment we should either not use an internally opened to -# :Apache streams, so the config must be: +# :Apache2 streams, so the config must be: # # SetHandler modperl # # and then either use $r->print("foo") or tie *STDOUT, $r + print "foo" # -# or close and re-open STDOUT to :Apache *after* the thread was spawned +# or close and re-open STDOUT to :Apache2 *after* the thread was spawned # # the above discussion equally applies to STDIN # @@ -39,14 +39,14 @@ } { - # close and re-open STDOUT to :Apache *after* the thread was + # close and re-open STDOUT to :Apache2 *after* the thread was # spawned my $thr = threads->new( sub { my $id = shift; close STDOUT; - open STDOUT, ">:Apache", $r - or die "can't open STDOUT via :Apache layer : $!"; + open STDOUT, ">:Apache2", $r + or die "can't open STDOUT via :Apache2 layer : $!"; print "thread $id\n"; return 1; }, 2); Modified: perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/redirect-cookie.pl URL: http://svn.apache.org/viewcvs/perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/redirect-cookie.pl?view=diff&r1=156568&r2=156569 ============================================================================== --- perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/redirect-cookie.pl (original) +++ perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/redirect-cookie.pl Tue Mar 8 13:22:57 2005 @@ -1,7 +1,7 @@ # test env vars -use Apache::URI (); -use Apache::Const -compile => qw(REDIRECT SERVER_ERROR); +use Apache2::URI (); +use Apache2::Const -compile => qw(REDIRECT SERVER_ERROR); my $r = shift; my $path = $r->args || ''; @@ -9,10 +9,10 @@ $r->err_headers_out->set('Set-Cookie' => "mod_perl=ubercool; path=/"); $r->headers_out->set(Location => " http://$server$path"); -$r->status(Apache::REDIRECT); +$r->status(Apache2::REDIRECT); # exit status is completely ignored in Registry # due to $r->status hacking -return Apache::SERVER_ERROR; +return Apache2::SERVER_ERROR; __END__ Modified: perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/redirect.pl URL: http://svn.apache.org/viewcvs/perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/redirect.pl?view=diff&r1=156568&r2=156569 ============================================================================== --- perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/redirect.pl (original) +++ perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/redirect.pl Tue Mar 8 13:22:57 2005 @@ -1,6 +1,6 @@ # test env vars -use Apache::URI (); +use Apache2::URI (); my $r = shift; my $path = $r->args || ''; Modified: perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/runtime_error_n_status_change.pl URL: http://svn.apache.org/viewcvs/perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/runtime_error_n_status_change.pl?view=diff&r1=156568&r2=156569 ============================================================================== --- perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/runtime_error_n_status_change.pl (original) +++ perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/runtime_error_n_status_change.pl Tue Mar 8 13:22:57 2005 @@ -3,9 +3,9 @@ t_server_log_error_is_expected(); } -use Apache::Const -compile => qw(NOT_FOUND); +use Apache2::Const -compile => qw(NOT_FOUND); my $r = shift; -$r->status(Apache::NOT_FOUND); +$r->status(Apache2::NOT_FOUND); $r->print("Content-type: text/plain\n\n"); $r->print(no_such_func()); Modified: perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/special_blocks.pl URL: http://svn.apache.org/viewcvs/perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/special_blocks.pl?view=diff&r1=156568&r2=156569 ============================================================================== --- perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/special_blocks.pl (original) +++ perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/special_blocks.pl Tue Mar 8 13:22:57 2005 @@ -2,7 +2,7 @@ # test BEGIN/END blocks -use Apache::RequestRec (); +use Apache2::RequestRec (); use vars qw($query); $query = '' unless defined $query; Modified: perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/status_change.pl URL: http://svn.apache.org/viewcvs/perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/status_change.pl?view=diff&r1=156568&r2=156569 ============================================================================== --- perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/status_change.pl (original) +++ perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/cgi-bin/status_change.pl Tue Mar 8 13:22:57 2005 @@ -1,5 +1,5 @@ -use Apache::Const -compile => qw(NOT_FOUND); +use Apache2::Const -compile => qw(NOT_FOUND); my $r = shift; -$r->status(Apache::NOT_FOUND); +$r->status(Apache2::NOT_FOUND); $r->print("Content-type: text/plain\n\n"); Modified: perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/conf/extra.conf.in URL: http://svn.apache.org/viewcvs/perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/conf/extra.conf.in?view=diff&r1=156568&r2=156569 ============================================================================== --- perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/conf/extra.conf.in (original) +++ perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/conf/extra.conf.in Tue Mar 8 13:22:57 2005 @@ -17,8 +17,6 @@ PerlSwitches [EMAIL PROTECTED]@/../lib \ [EMAIL PROTECTED]@/../../Apache-Test/lib \ [EMAIL PROTECTED]@/../../lib \ - [EMAIL PROTECTED]@/../../blib/lib/Apache2 \ - [EMAIL PROTECTED]@/../../blib/arch/Apache2 \ [EMAIL PROTECTED]@/../../blib/lib \ [EMAIL PROTECTED]@/../../blib/arch @@ -26,8 +24,8 @@ PerlRequire @ServerRoot@/conf/modperl_extra_startup.pl #### DEVMODE: Remove in production ### -PerlModule Apache::Reload -PerlInitHandler Apache::Reload +PerlModule Apache2::Reload +PerlInitHandler Apache2::Reload PerlSetVar ReloadAll Off PerlSetVar ReloadModules "ModPerl::*" Modified: perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/conf/modperl_extra_startup.pl URL: http://svn.apache.org/viewcvs/perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/conf/modperl_extra_startup.pl?view=diff&r1=156568&r2=156569 ============================================================================== --- perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/conf/modperl_extra_startup.pl (original) +++ perl/modperl/branches/apache2-rename-unstable/ModPerl-Registry/t/conf/modperl_extra_startup.pl Tue Mar 8 13:22:57 2005 @@ -3,20 +3,34 @@ use ModPerl::RegistryLoader (); -use Apache::ServerRec (); -use Apache::ServerUtil (); -use Apache::Process (); +use Apache2::ServerRec (); +use Apache2::ServerUtil (); +use Apache2::Process (); + +BEGIN { + ## XXX: Block of temporary hacks for CGI.pm + *Apache::request = *Apache2::request; + *Apache::server = *Apache2::server; + + for (qw/Response RequestRec RequestUtil/) { + eval qq( + \*Apache::$_\:: = \*Apache2::$_\::; + \$INC{"Apache/$_.pm"} = ') . __FILE__ . "';"; + die $@ if $@; + } +} + use DirHandle (); -my $proc = Apache->server->process; +my $proc = Apache2->server->process; my $pool = $proc->pool; # can't use catfile with server_root as it contains unix dir # separators and in a few of our particular tests we compare against # win32 separators. in general avoid using server_root_relative in your # code, see the manpage for more details -my $base_dir = Apache::ServerUtil::server_root_relative($pool, "cgi-bin"); +my $base_dir = Apache2::ServerUtil::server_root_relative($pool, "cgi-bin"); # test the scripts pre-loading by explicitly specifying uri => filename my $rl = ModPerl::RegistryLoader->new(package => "ModPerl::Registry"); @@ -33,7 +47,7 @@ sub trans { my $uri = shift; $uri =~ s|^/registry_bb/|cgi-bin/|; - return Apache::ServerUtil::server_root_relative($pool, $uri); + return Apache2::ServerUtil::server_root_relative($pool, $uri); } my $rl = ModPerl::RegistryLoader->new(