Updated catalyst.pl
[catagits/Catalyst-Runtime.git] / lib / Catalyst / DispatchType / Path.pm
index cffe66b..2cb950d 100644 (file)
@@ -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;
 }