From: Charlie Garrison Date: Sun, 28 Sep 2014 02:52:48 +0000 (+1000) Subject: Merge remote-tracking branch 'upstream/master' X-Git-Tag: 5.90102~4^2^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=6fcd837f2dd958b75d0be0a300076b738f181b8b;hp=950282bc140f3044f59fc3a70f6f63857f963d7b Merge remote-tracking branch 'upstream/master' --- diff --git a/Changes b/Changes index 541f876..5c246ec 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,13 @@ # This file documents the revision history for Perl extension Catalyst. +5.90073 - 2014-09-23 + - Fixed a regression caused by the last release where we broke what happened + when you tried to set request parameters via $c->req->param('foo', 'bar'). + You shouldn't do this, but I guess I shouldn't have busted it either :) + - Allow the term_width to be regenerated (see Catalyst::Utils::term_width, + Frew Schmidt) + - More aggressive skipping of value decoding if the value is undefined. + 5.90072 - 2014-09-15 - In the case where you call $c->req->param(undef), warn with a more useful warning (now gives the line of your code that called param with the undef, diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 69a49f1..471f9c3 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -127,7 +127,7 @@ __PACKAGE__->stats_class('Catalyst::Stats'); __PACKAGE__->_encode_check(Encode::FB_CROAK | Encode::LEAVE_SRC); # Remember to update this in Catalyst::Runtime as well! -our $VERSION = '5.90072'; +our $VERSION = '5.90073'; sub import { my ( $class, @arguments ) = @_; @@ -3086,6 +3086,7 @@ sub _handle_unicode_decoding { return unless defined $value; + ## I think this mess is to support the old nested if ( ref $value eq 'ARRAY' ) { foreach ( @$value ) { $_ = $self->_handle_unicode_decoding($_); @@ -3105,6 +3106,8 @@ sub _handle_unicode_decoding { sub _handle_param_unicode_decoding { my ( $self, $value ) = @_; + return unless defined $value; # not in love with just ignoring undefs - jnap + my $enc = $self->encoding; return try { Encode::is_utf8( $value ) ? diff --git a/lib/Catalyst/Request.pm b/lib/Catalyst/Request.pm index 39cc3a4..021bf24 100644 --- a/lib/Catalyst/Request.pm +++ b/lib/Catalyst/Request.pm @@ -672,7 +672,7 @@ sub param { } elsif ( @params > 1 ) { my $field = shift @params; - $self->parameters->{$field} = [@_]; + $self->parameters->{$field} = [@params]; } } diff --git a/lib/Catalyst/Runtime.pm b/lib/Catalyst/Runtime.pm index 446286f..fa9b74b 100644 --- a/lib/Catalyst/Runtime.pm +++ b/lib/Catalyst/Runtime.pm @@ -7,7 +7,7 @@ BEGIN { require 5.008003; } # Remember to update this in Catalyst as well! -our $VERSION = '5.90072'; +our $VERSION = '5.90073'; =head1 NAME diff --git a/lib/Catalyst/Utils.pm b/lib/Catalyst/Utils.pm index 78c293a..5ee7451 100644 --- a/lib/Catalyst/Utils.pm +++ b/lib/Catalyst/Utils.pm @@ -384,11 +384,21 @@ that 'env' now lists COLUMNS.) As last resort, default value of 80 chars will be used. +Calling C with a true value will cause it to be recalculated; you +can use this to cause it to get recalculated when your terminal is resized like +this + + $SIG{WINCH} = sub { Catalyst::Utils::term_width(1) }; + =cut my $_term_width; sub term_width { + my $force_reset = shift; + + undef $_term_width if $force_reset; + return $_term_width if $_term_width; my $width; diff --git a/t/undef-params.t b/t/undef-params.t index 8ce8e2c..a6d7594 100644 --- a/t/undef-params.t +++ b/t/undef-params.t @@ -22,6 +22,12 @@ use Plack::Test; $c->response->body("This is the body"); } + sub set_params :Local { + my ($self, $c) = @_; + $c->req->param(foo => 'a', 'b', 'c'); + $c->res->body(join ',', $c->req->param('foo')); + } + package MyApp; use Catalyst; @@ -37,8 +43,17 @@ ok my $psgi = MyApp->psgi_app, 'build psgi app'; test_psgi $psgi, sub { my $cb = shift; - my $res = $cb->(GET "/root/test"); - is $res->code, 200, 'OK'; + + { + my $res = $cb->(GET "/root/test"); + is $res->code, 200, 'OK'; + } + + { + my $res = $cb->(GET "/root/set_params"); + is $res->code, 200, 'OK'; + is $res->content, 'a,b,c'; + } }; done_testing;