X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FDispatcher.pm;h=c4e4dd09a71c42df415fcccd1b50865cc871b7a8;hb=7f23827ba42e87b4bf1f52d37534f3229a7f594d;hp=e330047c29904d32c32a105e64339d9116e52287;hpb=3d0d6d21a332320044e06386cccc67a9302b8c84;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index e330047..c4e4dd0 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -287,7 +287,7 @@ sub get_action { my ( $self, $name, $namespace ) = @_; return unless $name; - $namespace = join("/", grep { length } split '/', $namespace || "" ); + $namespace = join( "/", grep { length } split '/', $namespace || "" ); return $self->action_hash->{"$namespace/$name"}; } @@ -300,6 +300,7 @@ returns the named action by it's full path. sub get_action_by_path { my ( $self, $path ) = @_; + $path = "/$path" unless $path =~ /\//; $self->action_hash->{$path}; } @@ -311,7 +312,7 @@ sub get_actions { my ( $self, $c, $action, $namespace ) = @_; return [] unless $action; - $namespace = join("/", grep { length } split '/', $namespace || "" ); + $namespace = join( "/", grep { length } split '/', $namespace || "" ); my @match = $self->get_containers($namespace); @@ -331,9 +332,11 @@ sub get_containers { my @containers; - do { - push @containers, $self->container_hash->{$namespace}; - } while ( $namespace =~ s#/[^/]+$## ); + if ( length $namespace ) { + do { + push @containers, $self->container_hash->{$namespace}; + } while ( $namespace =~ s#/[^/]+$## ); + } return reverse grep { defined } @containers, $self->container_hash->{''};