[Apache-dispatch-devel] SF.net SVN: apache-dispatch: [46] trunk/t
Brought to you by:
geoffrey_young,
phred_moyer
|
From: <phr...@us...> - 2006-06-22 06:41:24
|
Revision: 46 Author: phred_moyer Date: 2006-06-21 23:41:19 -0700 (Wed, 21 Jun 2006) ViewCVS: http://svn.sourceforge.net/apache-dispatch/?rev=46&view=rev Log Message: ----------- - add test coverage for DispatchISA, which uncovered a bug - fix bug in DispatchISA which was caused by use of Apache::Dispatch::Util in Apache::Dispatch and Apache2::Dispatch's ISAs. Modified Paths: -------------- trunk/lib/Apache/Dispatch/Util.pm trunk/lib/Apache/Dispatch.pm trunk/lib/Apache2/Dispatch.pm trunk/t/conf/extra.last.conf.in trunk/t/lib/Apache2/Foo/Bar.pm Added Paths: ----------- trunk/t/04oo.t Modified: trunk/lib/Apache/Dispatch/Util.pm =================================================================== --- trunk/lib/Apache/Dispatch/Util.pm 2006-06-07 07:15:09 UTC (rev 45) +++ trunk/lib/Apache/Dispatch/Util.pm 2006-06-22 06:41:19 UTC (rev 46) @@ -261,8 +261,7 @@ # set the ISA array for the class # this method is for internal use only #--------------------------------------------------------------------- - my $pkg; - my ($class, $log, @parents) = @_; + my ($pkg, $class, $log, @parents) = @_; # turn off strict here so we can get at the class @ISA no strict 'refs'; @@ -270,11 +269,14 @@ $log->debug("\t\@ISA for $class currently contains ", (join ", ", @{"${class}::ISA"})); $log->debug("\tabout to merge ", (join ", ", @parents)); - - # only add classes to @ISA if they are not there already + + # only add classes to @ISA if they are not there already my %seen; @{"${class}::ISA"} = grep !$seen{$_}++, (@{"${class}::ISA"}, @parents); + + $log->debug("\t\@ISA for $class now contains ", + (join ", ", @{"${class}::ISA"})); return 1; } @@ -381,7 +383,6 @@ #--------------------------------------------------------------------- my $pkg = shift; - require Data::Dumper; my ($object, $method, $autoload, $log, $debug) = @_; @@ -393,7 +394,7 @@ if $debug > 1; if ($autoload) { - $coderef = $object->can($method) || $object->can("AUTOLOAD"); + $coderef = $object->can($method) || $object->can("AUTOLOAD"); } else { $coderef = $object->can($method); Modified: trunk/lib/Apache/Dispatch.pm =================================================================== --- trunk/lib/Apache/Dispatch.pm 2006-06-07 07:15:09 UTC (rev 45) +++ trunk/lib/Apache/Dispatch.pm 2006-06-22 06:41:19 UTC (rev 46) @@ -169,7 +169,7 @@ #--------------------------------------------------------------------- if (@parents) { - $rc = __PACKAGE__->_set_ISA($class, $log, $debug, @parents); + $rc = __PACKAGE__->_set_ISA($prefix, $log, @parents); unless ($rc) { $log->error("\tDispatchISA did not return successfully!"); Modified: trunk/lib/Apache2/Dispatch.pm =================================================================== --- trunk/lib/Apache2/Dispatch.pm 2006-06-07 07:15:09 UTC (rev 45) +++ trunk/lib/Apache2/Dispatch.pm 2006-06-22 06:41:19 UTC (rev 46) @@ -119,7 +119,7 @@ #--------------------------------------------------------------------- if (@parents) { - $rc = __PACKAGE__->_set_ISA($class, $log, @parents); + $rc = __PACKAGE__->_set_ISA($prefix, $log, @parents); unless ($rc) { $log->error("\tDispatchISA did not return successfully!"); Added: trunk/t/04oo.t =================================================================== --- trunk/t/04oo.t (rev 0) +++ trunk/t/04oo.t 2006-06-22 06:41:19 UTC (rev 46) @@ -0,0 +1,13 @@ +use strict; +use warnings FATAL => 'all'; + +use Apache::Test qw(-withtestmore); +use Apache::TestRequest; + +plan tests => 2, \&need_lwp; + +my $url = '/oo/baz'; + +my $res = GET $url; +ok($res->is_success); +ok($res->content =~ m/dispatch_baz/i); Modified: trunk/t/conf/extra.last.conf.in =================================================================== --- trunk/t/conf/extra.last.conf.in 2006-06-07 07:15:09 UTC (rev 45) +++ trunk/t/conf/extra.last.conf.in 2006-06-22 06:41:19 UTC (rev 46) @@ -55,14 +55,16 @@ SetHandler perl-script DispatchRequire On DispatchAUTOLOAD On - DispatchISA Foo::Parent DispatchDebug 2 <IfDefine APACHE2> DispatchPrefix Apache2::Foo + DispatchISA Apache2::Foo::Bar PerlResponseHandler Apache2::Dispatch </IfDefine> <IfDefine APACHE1> DispatchPrefix Apache::Foo + PerlModule Apache::Foo::Bar + DispatchISA Apache::Foo::Bar PerlHandler Apache::Dispatch </IfDefine> Modified: trunk/t/lib/Apache2/Foo/Bar.pm =================================================================== --- trunk/t/lib/Apache2/Foo/Bar.pm 2006-06-07 07:15:09 UTC (rev 45) +++ trunk/t/lib/Apache2/Foo/Bar.pm 2006-06-22 06:41:19 UTC (rev 46) @@ -7,8 +7,6 @@ use Apache2::RequestRec; use Apache2::RequestIO; -@Foo::Bar::ISA = qw(Apache2::Foo::Foo); - sub dispatch_baz { my ($class, $r) = @_; $r->log->debug("$class->dispatch_baz()"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |