no :PathPart -> :PathPart('subname')
Matt S Trout [Thu, 22 Jun 2006 14:51:58 +0000 (14:51 +0000)]
r10066@cain (orig r4397):  matthewt | 2006-06-17 20:48:29 +0000

lib/Catalyst/DispatchType/ChildOf.pm
t/lib/TestApp/Controller/Action/ChildOf.pm
t/lib/TestApp/Controller/Action/ChildOf/Foo.pm

index f54e322..2ab537e 100644 (file)
@@ -189,10 +189,10 @@ sub register {
 
     my @path_part = @{ $action->attributes->{PathPart} || [] };
 
-    my $part = '';
+    my $part = $action->name;
 
-    if (@path_part == 1) {
-        $part = (defined $path_part[0] ? $path_part[0] : $action->name);
+    if (@path_part == 1 && defined $path_part[0]) {
+        $part = $path_part[0];
     } elsif (@path_part > 1) {
         Catalyst::Exception->throw(
           "Multiple PathPart attributes not supported registering ${action}"
index a244a98..ba6e5d2 100644 (file)
@@ -23,7 +23,7 @@ sub endpoint2 :PathPart('end2') :ChildOf('/action/childof/foo2') :Args(2) { }
 #   Relative specification of parent action
 #
 sub bar :PathPart('childof/bar') :ChildOf('/') :Captures(0) { }
-sub finale :ChildOf('bar') :Args { }
+sub finale :PathPart('') :ChildOf('bar') :Args { }
 
 #
 #   three chain with concurrent endpoints
@@ -49,7 +49,7 @@ sub higher_root :PathPart('bar') :ChildOf('/action/childof/foo/higher_root') :Ar
 #   Controller -> subcontroller -> controller
 #
 sub pcp1 :PathPart('childof/pcp1')  :ChildOf('/')                        :Captures(1) { }
-sub pcp3 :PathPart                  :ChildOf('/action/childof/foo/pcp2') :Args(1)     { }
+sub pcp3 :ChildOf('/action/childof/foo/pcp2') :Args(1)     { }
 
 #
 #   Dispatch on capture number
index 1e1ea0a..d75f45a 100644 (file)
@@ -8,7 +8,7 @@ use base qw/Catalyst::Controller/;
 #
 #   Child of current namespace
 #
-sub spoon :PathPart :ChildOf('') :Args(0) { }
+sub spoon :ChildOf('') :Args(0) { }
 
 #
 #   Root for a action in a "parent" controller
@@ -18,7 +18,7 @@ sub higher_root :PathPart('childof/higher_root') :ChildOf('/') :Captures(1) { }
 #
 #   Parent controller -> this subcontroller -> parent controller test
 #
-sub pcp2 :PathPart :ChildOf('/action/childof/pcp1') :Captures(1) { }
+sub pcp2 :ChildOf('/action/childof/pcp1') :Captures(1) { }
 
 #
 #   Controllers not in parent/child relation. This tests the end.