fix root default thingie jayk gave me, sanitize Paths at registration time better
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Dispatcher.pm
index cb22e63..680a76b 100644 (file)
@@ -370,9 +370,7 @@ sub prepare_action {
 
   DESCEND: while (@path) {
         $path = join '/', @path;
-        $path =~ s#^/##;
-
-        $path = '' if $path eq '/';    # Root action
+        $path =~ s#^/+##;
 
         # Check out dispatch types to see if any will handle the path at
         # this level
@@ -459,9 +457,6 @@ sub get_containers {
     }
 
     return reverse grep { defined } @containers, $self->_container_hash->{''};
-
-    #return (split '/', $namespace); # isnt this more clear?
-    my @parts = split '/', $namespace;
 }
 
 =head2 $self->uri_for_action($action, \@captures)
@@ -535,7 +530,7 @@ sub register {
     my @normal_dtypes;
     my @low_precedence_dtypes;
 
-    while (my $type = shift @dtypes) {
+    for my $type ( @dtypes ) {
         if ($type->isa('Catalyst::DispatchType::Index') ||  
             $type->isa('Catalyst::DispatchType::Default')) {
             push @low_precedence_dtypes, $type;