You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@apache.org on 2001/04/13 04:05:58 UTC
cvs commit: modperl-2.0/t/hooks/TestHooks trans.pm
dougm 01/04/12 19:05:58
Added: t/hooks trans.t
t/hooks/TestHooks trans.pm
Log:
add test for PerlTransHandler
Revision Changes Path
1.1 modperl-2.0/t/hooks/trans.t
Index: trans.t
===================================================================
use strict;
use warnings FATAL => 'all';
use Apache::Test;
use Apache::TestRequest;
use Apache::Const ':common';
plan tests => 3, \&have_lwp;
ok GET_RC('/nope') == NOT_FOUND;
my $module = '/TestHooks/trans.pm';
my $body = GET_BODY $module;
ok $body =~ /package TestHooks::trans/;
ok GET_OK '/phooey';
1.1 modperl-2.0/t/hooks/TestHooks/trans.pm
Index: trans.pm
===================================================================
package TestHooks::trans;
use strict;
use warnings FATAL => 'all';
my %trans = (
'/TestHooks/trans.pm' => sub {
my $r = shift;
$r->filename(__FILE__);
Apache::OK;
},
'/phooey' => sub {
shift->uri('/TestHooks::trans');
Apache::OK;
},
);
sub handler {
my $r = shift;
my $handler = $trans{ $r->uri };
return Apache::DECLINED unless $handler;
$handler->($r);
}
1;
__DATA__
PerlResponseHandler Apache::TestHandler::ok1
SetHandler modperl