Method which adds the namespace for plugins and actions.
__PACKAGE__->setup(qw(MyPlugin));
-
+
# will load Catalyst::Plugin::MyPlugin
=cut
my $appnamespace = shift;
my $namespace = shift;
my @classes = @_;
- return String::RewritePrefix->rewrite(
- { '' => $namespace.'::', '+' => '', '~' => $appnamespace . '::' }, @classes,
- );
+ return String::RewritePrefix->rewrite({
+ q[] => qq[${namespace}::],
+ q[+] => q[],
+ (defined $appnamespace
+ ? (q[~] => qq[${appnamespace}::])
+ : ()
+ ),
+ }, @classes);
}