geoff 2003/10/21 15:20:18
Modified: lib/Apache compat.pm t/response/TestCompat apache.pm Log: special handling for Apache::Constants :response import tag Revision Changes Path 1.89 +8 -1 modperl-2.0/lib/Apache/compat.pm Index: compat.pm =================================================================== RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v retrieving revision 1.88 retrieving revision 1.89 diff -u -r1.88 -r1.89 --- compat.pm 30 Aug 2003 02:33:26 -0000 1.88 +++ compat.pm 21 Oct 2003 22:20:18 -0000 1.89 @@ -148,7 +148,14 @@ sub import { my $class = shift; my $package = scalar caller; - Apache::Const->compile($package => @_); + + my @args = @_; + + # treat :response as :common - it's not perfect + # but simple and close enough for the majority + my %args = map { s/^:response$/:common/; $_ => 1 } @args; + + Apache::Const->compile($package => keys %args); } #no need to support in 2.0 1.7 +14 -2 modperl-2.0/t/response/TestCompat/apache.pm Index: apache.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/apache.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- apache.pm 19 Sep 2003 00:37:09 -0000 1.6 +++ apache.pm 21 Oct 2003 22:20:18 -0000 1.7 @@ -11,12 +11,12 @@ use Apache::Test; use Apache::compat (); -use Apache::Constants qw(OK DIR_MAGIC_TYPE); +use Apache::Constants qw(DIR_MAGIC_TYPE :common :response); sub handler { my $r = shift; - plan $r, tests => 8; + plan $r, tests => 11; $r->send_http_header('text/plain'); @@ -42,8 +42,20 @@ Apache::log_error("Apache::log_error test ok"); ok 1; + # explicitly imported ok t_cmp("httpd/unix-directory", DIR_MAGIC_TYPE, 'DIR_MAGIC_TYPE'); + + # :response is ignored, but is now aliased in :common + ok t_cmp("302", REDIRECT, + 'REDIRECT'); + + # from :common + ok t_cmp("401", AUTH_REQUIRED, + 'AUTH_REQUIRED'); + + ok t_cmp("0", OK, + 'OK'); my $admin = $r->server->server_admin; Apache->httpd_conf('ServerAdmin [EMAIL PROTECTED]');