X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FDispatchType%2FChained.pm;h=52ba7c9438013bb451a719e06b86b65889dba6fd;hp=132d9efb443f2465604b77a78b79e24106dd049d;hb=1dc8af447f43168c875c0c62f2cfb50d66173eaf;hpb=e5c7adea1c2115b30ff57b2f6e6035020c5216d3 diff --git a/lib/Catalyst/DispatchType/Chained.pm b/lib/Catalyst/DispatchType/Chained.pm index 132d9ef..52ba7c9 100644 --- a/lib/Catalyst/DispatchType/Chained.pm +++ b/lib/Catalyst/DispatchType/Chained.pm @@ -163,24 +163,26 @@ Matt is an idiot and hasn't documented this yet. sub register { my ( $self, $c, $action ) = @_; - my @child_of_attr = @{ $action->attributes->{Chained} || [] }; + my @chained_attr = @{ $action->attributes->{Chained} || [] }; - return 0 unless @child_of_attr; + return 0 unless @chained_attr; - if (@child_of_attr > 2) { + if (@chained_attr > 2) { Catalyst::Exception->throw( "Multiple Chained attributes not supported registering ${action}" ); } - my $parent = $child_of_attr[0]; + my $parent = $chained_attr[0]; if (defined($parent) && length($parent)) { - unless ($parent =~ m/^\//) { + if ($parent eq '.') { + $parent = '/'.$action->namespace; + } elsif ($parent !~ m/^\//) { $parent = '/'.join('/', $action->namespace, $parent); } } else { - $parent = '/'.$action->namespace; + $parent = '/' } $action->attributes->{Chained} = [ $parent ];