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}"
# 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
# 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
#
# Child of current namespace
#
-sub spoon :PathPart :ChildOf('') :Args(0) { }
+sub spoon :ChildOf('') :Args(0) { }
#
# Root for a action in a "parent" controller
#
# 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.