From: Florian Ragwitz Date: Fri, 26 Jun 2009 19:45:45 +0000 (+0000) Subject: Fix annoying warnings in Utils::resolve_namespace. X-Git-Tag: 5.80006~21 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=196932def5cc8ade4af7e52b40cc61bd460ee69d Fix annoying warnings in Utils::resolve_namespace. Also get rid of some other nits introduced with resolve_namespace. --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 435eee6..9a886e6 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -2511,7 +2511,7 @@ the plugin name does not begin with C. $class->_plugins( {} ) unless $class->_plugins; $plugins ||= []; - + my @plugins = Catalyst::Utils::resolve_namespace($class . '::Plugin', 'Catalyst::Plugin', @$plugins); for my $plugin ( reverse @plugins ) { diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index 5a975ed..d54d2ea 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -680,7 +680,7 @@ of course it's being used.) sub dispatch_type { my ($self, $name) = @_; - + # first param is undef because we cannot get the appclass $name = Catalyst::Utils::resolve_namespace(undef, 'Catalyst::DispatchType', $name); diff --git a/lib/Catalyst/Utils.pm b/lib/Catalyst/Utils.pm index 5bff574..05248fc 100644 --- a/lib/Catalyst/Utils.pm +++ b/lib/Catalyst/Utils.pm @@ -385,7 +385,7 @@ sub term_width { Method which adds the namespace for plugins and actions. __PACKAGE__->setup(qw(MyPlugin)); - + # will load Catalyst::Plugin::MyPlugin =cut @@ -395,9 +395,14 @@ sub resolve_namespace { 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); } diff --git a/t/aggregate/live_component_controller_action_action.t b/t/aggregate/live_component_controller_action_action.t index 1e11b18..fd2b4cd 100644 --- a/t/aggregate/live_component_controller_action_action.t +++ b/t/aggregate/live_component_controller_action_action.t @@ -106,7 +106,7 @@ sub run_tests { 'Content is a serialized Catalyst::Request' ); } - + { ok( my $response = request('http://localhost/action_action_five'), 'Request' ); @@ -126,7 +126,6 @@ sub run_tests { 'Content is a serialized Catalyst::Request' ); } - { ok( my $response = request('http://localhost/action_action_six'),