From: Brian Cassidy Date: Mon, 24 Apr 2006 14:14:47 +0000 (+0000) Subject: ignore undefined values in uri_for and uri_with X-Git-Tag: 5.7099_04~615 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=0e8ab4caab000235ca4dcd614d0b69e593fbc02c ignore undefined values in uri_for and uri_with --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index e18ba6c..f1bfec4 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -881,7 +881,7 @@ sub uri_for { if( $isa_ref and $isa_ref ne 'ARRAY' ) { croak( "Non-array reference ($isa_ref) passed to uri_for()" ); } - utf8::encode( $_ ) for $isa_ref ? @$value : $value; + utf8::encode( $_ ) for grep { defined } $isa_ref ? @$value : $value; }; # join args with '/', or a blank string diff --git a/lib/Catalyst/Request.pm b/lib/Catalyst/Request.pm index 46e0df6..d8ead36 100644 --- a/lib/Catalyst/Request.pm +++ b/lib/Catalyst/Request.pm @@ -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;