ignore undefined values in uri_for and uri_with
Brian Cassidy [Mon, 24 Apr 2006 14:14:47 +0000 (14:14 +0000)]
lib/Catalyst.pm
lib/Catalyst/Request.pm

index e18ba6c..f1bfec4 100644 (file)
@@ -881,7 +881,7 @@ sub uri_for {
         if( $isa_ref and $isa_ref ne 'ARRAY' ) {\r
             croak( "Non-array reference ($isa_ref) passed to uri_for()" );\r
         }\r
-        utf8::encode( $_ ) for $isa_ref ? @$value : $value;\r
+        utf8::encode( $_ ) for grep { defined } $isa_ref ? @$value : $value;\r
     };
     
     # join args with '/', or a blank string
index 46e0df6..d8ead36 100644 (file)
@@ -509,7 +509,7 @@ sub uri_with {
         if( $isa_ref and $isa_ref ne 'ARRAY' ) {
             croak( "Non-array reference ($isa_ref) passed to uri_with()" );
         }
-        utf8::encode( $_ ) for $isa_ref ? @$value : $value;
+        utf8::encode( $_ ) for grep{ defined } $isa_ref ? @$value : $value;
     };
     my $uri = $self->uri->clone;