Fix to allow uri_for and uri_with to stringify non-array references
[catagits/Catalyst-Runtime.git] / lib / Catalyst.pm
index fd00793..c3b59b9 100644 (file)
@@ -869,7 +869,7 @@ in standard fashion.
 
 Instead of C<$path>, you can also optionally pass a C<$action> object
 which will be resolved to a path using
-C<< $c->dispatcher->uri_for_action .>; if the first element of
+C<< $c->dispatcher->uri_for_action >>; if the first element of
 C<@args> is an arrayref it is treated as a list of captures to be passed
 to C<uri_for_action>.
 
@@ -902,11 +902,10 @@ sub uri_for {
       ( scalar @args && ref $args[$#args] eq 'HASH' ? pop @args : {} );
 
     for my $value ( values %$params ) {
-        my $isa_ref = ref $value;
-        if( $isa_ref and $isa_ref ne 'ARRAY' ) {
-            croak( "Non-array reference ($isa_ref) passed to uri_for()" );
+        for ( ref $value eq 'ARRAY' ? @$value : $value ) {
+            $_ = "$_";
+            utf8::encode( $_ );
         }
-        utf8::encode( $_ ) for grep { defined } $isa_ref ? @$value : $value;
     };
     
     # join args with '/', or a blank string
@@ -1795,7 +1794,7 @@ sub setup_components {
     );
     
     for my $component ( sort { length $a <=> length $b } $locator->plugins ) {
-        Catalyst::Utils::ensure_class_loaded( $component );
+        Catalyst::Utils::ensure_class_loaded( $component, { ignore_loaded => 1 } );
 
         my $module  = $class->setup_component( $component );
         my %modules = (