Make sure generated names don't have two slashes in a row
Dave Rolsky [Sun, 23 Jan 2011 21:10:39 +0000 (15:10 -0600)]
lib/CatalystX/Routes.pm

index 1bde24f..9363f1d 100644 (file)
@@ -48,10 +48,13 @@ sub _add_route {
         $attrs->{Chained} = q{/};
     }
 
+    my $name = $_[0];
+    $name =~ s{^/}{};
+
     # We need to turn the full chain name into a path, since two end points
     # from two different chains could have the same end point name.
-    my $name = ( $attrs->{Chained} eq '/' ? q{} : $attrs->{Chained} ) . q{/}
-        . $_[0];
+    $name = ( $attrs->{Chained} eq '/' ? q{} : $attrs->{Chained} ) . q{/}
+        . $name;
 
     my $meth_base = '__route__' . $name;