fix $c->view() bug hopefully
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
index e877ac8..549af88 100644 (file)
@@ -76,7 +76,7 @@ __PACKAGE__->stats_class('Catalyst::Stats');
 
 # Remember to update this in Catalyst::Runtime as well!
 
-our $VERSION = '5.80004';
+our $VERSION = '5.80005';
 
 {
     my $dev_version = $VERSION =~ /_\d{2}$/;
@@ -493,8 +493,13 @@ sub clear_errors {
     $c->error(0);
 }
 
-# search components given a name and some prefixes
 sub _comp_search_prefixes {
+    my $c = shift;
+    return map $c->components->{ $_ }, $c->_comp_names_search_prefixes(@_);
+}
+
+# search components given a name and some prefixes
+sub _comp_names_search_prefixes {
     my ( $c, $name, @prefixes ) = @_;
     my $appclass = ref $c || $c;
     my $filter   = "^${appclass}::(" . join( '|', @prefixes ) . ')::';
@@ -510,18 +515,18 @@ sub _comp_search_prefixes {
     my $query  = ref $name ? $name : qr/^$name$/i;
     my @result = grep { $eligible{$_} =~ m{$query} } keys %eligible;
 
-    return map { $c->components->{ $_ } } @result if @result;
+    return @result if @result;
 
     # if we were given a regexp to search against, we're done.
     return if ref $name;
 
     # regexp fallback
     $query  = qr/$name/i;
-    @result = map { $c->components->{ $_ } } grep { $eligible{ $_ } =~ m{$query} } keys %eligible;
+    @result = grep { $eligible{ $_ } =~ m{$query} } keys %eligible;
 
     # no results? try against full names
     if( !@result ) {
-        @result = map { $c->components->{ $_ } } grep { m{$query} } keys %eligible;
+        @result = grep { m{$query} } keys %eligible;
     }
 
     # don't warn if we didn't find any results, it just might not exist
@@ -558,7 +563,9 @@ sub _comp_names {
 
     my $filter = "^${appclass}::(" . join( '|', @prefixes ) . ')::';
 
-    my @names = map { s{$filter}{}; $_; } $c->_comp_search_prefixes( undef, @prefixes );
+    my @names = map { s{$filter}{}; $_; }
+        $c->_comp_names_search_prefixes( undef, @prefixes );
+
     return @names;
 }
 
@@ -1192,7 +1199,7 @@ sub uri_for {
       ( scalar @args && ref $args[$#args] eq 'HASH' ? pop @args : {} );
 
     carp "uri_for called with undef argument" if grep { ! defined $_ } @args;
-    s/([^A-Za-z0-9\-_.!~*'()])/$URI::Escape::escapes{$1}/go for @args;
+    s/([^A-Za-z0-9\-_.!~*'()+])/$URI::Escape::escapes{$1}/go for @args;
 
     unshift(@args, $path);
 
@@ -2504,10 +2511,9 @@ the plugin name does not begin with C<Catalyst::Plugin::>.
         $plugins ||= [];
 
         my @plugins = map { s/\A\+// ? $_ : "Catalyst::Plugin::$_" } @$plugins;
-        
-        Class::MOP::load_class($_) for @plugins;
-        
+
         for my $plugin ( reverse @plugins ) {
+            Class::MOP::load_class($plugin);
             my $meta = find_meta($plugin);
             next if $meta && $meta->isa('Moose::Meta::Role');
 
@@ -2519,7 +2525,7 @@ the plugin name does not begin with C<Catalyst::Plugin::>.
             grep { $_ && blessed($_) && $_->isa('Moose::Meta::Role') }
             map { find_meta($_) }
             @plugins;
-         
+
         Moose::Util::apply_all_roles(
             $class => @roles
         ) if @roles;
@@ -2778,7 +2784,7 @@ willert: Sebastian Willert <willert@cpan.org>
 
 =head1 LICENSE
 
-This library is free software, you can redistribute it and/or modify it under
+This library is free software. You can redistribute it and/or modify it under
 the same terms as Perl itself.
 
 =cut