X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FRequest.pm;h=7b41cfebcb0b0fe1036bcea5f6856fd16acffbd6;hp=09fb8d5f4d4fb4575ef0ad36b383c8f29568e833;hb=b9d96e27325fd2b5bc7ff2bd28e5c96675b42c7f;hpb=9d8d0ab94e468c7399f6efdff4735d8b3a54307a diff --git a/lib/Catalyst/Request.pm b/lib/Catalyst/Request.pm index 09fb8d5..7b41cfe 100644 --- a/lib/Catalyst/Request.pm +++ b/lib/Catalyst/Request.pm @@ -10,7 +10,7 @@ use HTTP::Headers; use Stream::Buffered; use Hash::MultiValue; use Scalar::Util; - +use HTTP::Body; use Moose; use namespace::clean -except => 'meta'; @@ -645,9 +645,15 @@ sub param { return keys %{ $self->parameters }; } - if ( @_ == 1 ) { + # If anything in @_ is undef, carp about that, and remove it from + # the list; + + my @params = grep { defined($_) ? 1 : do {carp "You called ->params with an undefined value"; 0} } @_; + + if ( @params == 1 ) { - my $param = shift; + defined(my $param = shift @params) || + carp "You called ->params with an undefined value 2"; unless ( exists $self->parameters->{$param} ) { return wantarray ? () : undef; @@ -664,9 +670,9 @@ sub param { : $self->parameters->{$param}; } } - elsif ( @_ > 1 ) { - my $field = shift; - $self->parameters->{$field} = [@_]; + elsif ( @params > 1 ) { + my $field = shift @params; + $self->parameters->{$field} = [@params]; } } @@ -871,7 +877,7 @@ sub mangle_params { next unless defined $value; for ( ref $value eq 'ARRAY' ? @$value : $value ) { $_ = "$_"; - utf8::encode( $_ ) if utf8::is_utf8($_); + # utf8::encode($_); } };