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=4d5f0ed775dcd52acd3f6119329d3396f93cf5b1;hb=17b3d80076b6acb25d56ed83b0ed7134ed4fb343;hpb=ae29b412955743885e80350085167b54b69672da diff --git a/lib/Catalyst/Utils.pm b/lib/Catalyst/Utils.pm index 4d5f0ed..76f0733 100644 --- a/lib/Catalyst/Utils.pm +++ b/lib/Catalyst/Utils.pm @@ -9,6 +9,8 @@ use URI; use Carp qw/croak/; use Cwd; +use String::RewritePrefix; + use namespace::clean; =head1 NAME @@ -377,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