X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FUtils.pm;h=76f07335354bd92abb97f9b5bfb576f71fa0f708;hp=07c20585015c3e3263890d10b593a27df0ff627b;hb=17b3d80076b6acb25d56ed83b0ed7134ed4fb343;hpb=39fc2ce1e456c4e2a272204aa8fe67896984b3a6 diff --git a/lib/Catalyst/Utils.pm b/lib/Catalyst/Utils.pm index 07c2058..76f0733 100644 --- a/lib/Catalyst/Utils.pm +++ b/lib/Catalyst/Utils.pm @@ -9,6 +9,10 @@ use URI; use Carp qw/croak/; use Cwd; +use String::RewritePrefix; + +use namespace::clean; + =head1 NAME Catalyst::Utils - The Catalyst Utils @@ -375,6 +379,27 @@ sub term_width { return $_term_width = $width; } + +=head2 resolve_namespace + +Method which adds the namespace for plugins and actions. + + __PACKAGE__->setup(qw(MyPlugin)); + + # will load Catalyst::Plugin::MyPlugin + +=cut + + +sub resolve_namespace { + my $namespace = shift; + my @classes = @_; + return String::RewritePrefix->rewrite( + { '' => $namespace.'::', '+' => '' }, @classes, + ); +} + + =head1 AUTHORS Catalyst Contributors, see Catalyst.pm