Reformatted documentation
[catagits/Catalyst-Runtime.git] / lib / Catalyst / DispatchType / Path.pm
index cffe66b..1672712 100644 (file)
@@ -16,9 +16,7 @@ See L<Catalyst>.
 
 =head1 METHODS
 
-=over 4
-
-=item $self->list($c)
+=head2 $self->list($c)
 
 =cut
 
@@ -33,7 +31,7 @@ sub list {
       if ( keys %{ $self->{paths} } );
 }
 
-=item $self->match( $c, $path )
+=head2 $self->match( $c, $path )
 
 =cut
 
@@ -51,7 +49,7 @@ sub match {
     return 0;
 }
 
-=item $self->register( $c, $action )
+=head2 $self->register( $c, $action )
 
 =cut
 
@@ -62,8 +60,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,21 +80,21 @@ 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)
+=head2 $self->register_path($c, $path, $action)
 
 =cut
 
 sub register_path {
-    my ($self, $c, $path, $action) = @_;
+    my ( $self, $c, $path, $action ) = @_;
     $path =~ s!^/!!;
     $self->{paths}{$path} = $action;
 }
 
-=back
-
 =head1 AUTHOR
 
 Matt S Trout