sub get_action {
my ( $self, $name, $namespace ) = @_;
return unless $name;
- $namespace ||= '';
- $namespace = '' if $namespace eq '/';
+
+ $namespace = join( "/", grep { length } split '/', $namespace || "" );
return $self->action_hash->{"$namespace/$name"};
}
+=head2 $self->get_action_by_path( $path );
+
+returns the named action by it's full path.
+
+=cut
+
+sub get_action_by_path {
+ my ( $self, $path ) = @_;
+ $path = "/$path" unless $path =~ /\//;
+ $self->action_hash->{$path};
+}
+
=head2 $self->get_actions( $c, $action, $namespace )
=cut
sub get_actions {
my ( $self, $c, $action, $namespace ) = @_;
return [] unless $action;
- $namespace ||= '';
- $namespace = '' if $namespace eq '/';
+
+ $namespace = join( "/", grep { length } split '/', $namespace || "" );
my @match = $self->get_containers($namespace);