X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FDispatchType%2FPath.pm;h=2cb950dac4f92db0e448fbf08eb1198f844a42ff;hb=640faa87f0c572b58acd22124bfa6f6c59106873;hp=cffe66b4f591d85db281335aabce6ebdb268404a;hpb=081def36ee509794aa7b30768c699b16636cee33;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/DispatchType/Path.pm b/lib/Catalyst/DispatchType/Path.pm index cffe66b..2cb950d 100644 --- a/lib/Catalyst/DispatchType/Path.pm +++ b/lib/Catalyst/DispatchType/Path.pm @@ -62,8 +62,9 @@ sub register { my @register; foreach my $r ( @{ $attrs->{Path} || [] } ) { - unless ( $r ) { + unless ($r) { $r = $action->namespace; + $r = '' if $r eq '/'; } elsif ( $r !~ m!^/! ) { # It's a relative path $r = $action->namespace . "/$r"; @@ -81,7 +82,9 @@ sub register { # Register sub name as a relative path } - $self->register_path($c, $_, $action) for @register; + $self->register_path( $c, $_, $action ) for @register; + return 1 if @register; + return 0; } =item $self->register_path($c, $path, $action) @@ -89,7 +92,7 @@ sub register { =cut sub register_path { - my ($self, $c, $path, $action) = @_; + my ( $self, $c, $path, $action ) = @_; $path =~ s!^/!!; $self->{paths}{$path} = $action; }