From: John Napiorkowski Date: Wed, 22 Jul 2015 19:10:28 +0000 (-0500) Subject: Merge branch 'wolfsage-topic/pod-nit' into orpington X-Git-Tag: 5.90094~4^2~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=cf57a483d6a2c4522a432ec073158ab07260e3f4;hp=27d0c51afdb84b4390e0c6ecc4860d2a4576b78c Merge branch 'wolfsage-topic/pod-nit' into orpington --- diff --git a/Changes b/Changes index d842512..01d6a36 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,14 @@ # This file documents the revision history for Perl extension Catalyst. +5.90099_001 - TBA + - Merged Pull Requests: + - https://github.com/perl-catalyst/catalyst-runtime/pull/95 + - https://github.com/perl-catalyst/catalyst-runtime/pull/96 + - https://github.com/perl-catalyst/catalyst-runtime/pull/97 + - https://github.com/perl-catalyst/catalyst-runtime/pull/98 + - Fixed issue where last_error actually returned the first error. Took + the change to add a 'pop_errors' to give the inverse of shift_errors. + 5.90093 - 2015-05-29 - Fixed a bug where if you used $res->write and then $res->body, the contents of body would be double encoded (gshank++). diff --git a/README.mkdn b/README.mkdn index f30025c..d673134 100644 --- a/README.mkdn +++ b/README.mkdn @@ -1440,7 +1440,7 @@ variable should be used for determining the request path. decoded, this means that applications using this mode can correctly handle URIs including the %2F character (i.e. with `AllowEncodedSlashes` set to `On` in Apache). - Given that this method of path resolution is provably more correct, it is recommended that you use + Given that this method of path resolution is probably more correct, it is recommended that you use this unless you have a specific need to deploy your application in a non-standard environment, and you are aware of the implications of not being able to handle encoded URI paths correctly. @@ -1454,7 +1454,7 @@ variable should be used for determining the request path. - `using_frontend_proxy_path` - Enabled [Plack::Middleware::ReverseProxyPath](https://metacpan.org/pod/Plack::Middleware::ReverseProxyPath) on your application (if installed, otherwise log an error). This is useful if your application is not running on the 'root' (or /) of your host server. **NOTE** if you use this feature you should add the required -middleware to your project dependency list since its not automatically a dependency of [Catalyst](https://metacpan.org/pod/Catalyst). +middleware to your project dependency list since it's not automatically a dependency of [Catalyst](https://metacpan.org/pod/Catalyst). This has been done since not all people need this feature and we wish to restrict the growth of [Catalyst](https://metacpan.org/pod/Catalyst) dependencies. - `encoding` - See ["ENCODING"](#encoding) @@ -1515,7 +1515,7 @@ This has been done since not all people need this feature and we wish to restric - `do_not_decode_query` If true, then do not try to character decode any wide characters in your - request URL query or keywords. Most readings of the relevent specifications + request URL query or keywords. Most readings of the relevant specifications suggest these should be UTF-\* encoded, which is the default that [Catalyst](https://metacpan.org/pod/Catalyst) will use, hwoever if you are creating a lot of URLs manually or have external evil clients, this might cause you trouble. If you find the changes introduced @@ -2009,7 +2009,7 @@ acme: Leon Brocard abraxxa: Alexander Hartmaier -andrewalker: André Walker +andrewalker: André Walker Andrew Bramble @@ -2067,7 +2067,7 @@ groditi: Guillermo Roditi hobbs: Andrew Rodland -ilmari: Dagfinn Ilmari Mannsåker +ilmari: Dagfinn Ilmari MannsÃ¥ker jcamacho: Juan Camacho diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 0148bd2..d08e7ba 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -180,7 +180,7 @@ sub composed_stats_class { __PACKAGE__->_encode_check(Encode::FB_CROAK | Encode::LEAVE_SRC); # Remember to update this in Catalyst::Runtime as well! -our $VERSION = '5.90093'; +our $VERSION = '5.90099_001'; $VERSION = eval $VERSION if $VERSION =~ /_/; # numify for warning-free dev releases sub import { @@ -521,7 +521,7 @@ L<< detach|/"$c->detach( $action [, \@arguments ] )" >>. Like C<< $c->visit >>, C<< $c->go >> will perform a full dispatch on the specified action or method, with localized C<< $c->action >> and C<< $c->namespace >>. Like C, C escapes the processing of the current request chain on completion, and -does not return to its cunless blessed $cunless blessed $caller. +does not return to its caller. @arguments are arguments to the final destination of $action. @captures are arguments to the intermediate steps, if any, on the way to the final sub of @@ -640,22 +640,42 @@ sub has_errors { scalar(@{shift->error}) ? 1:0 } =head2 $c->last_error Returns the most recent error in the stack (the one most recently added...) -or nothing if there are no errors. +or nothing if there are no errors. This does not modify the contents of the +error stack. =cut -sub last_error { my ($err, @errs) = @{shift->error}; return $err } +sub last_error { + my (@errs) = @{shift->error}; + return scalar(@errs) ? $errs[-1]: undef; +} =head2 shift_errors -shifts the most recently added error off the error stack and returns if. Returns +shifts the most recently added error off the error stack and returns it. Returns nothing if there are no more errors. =cut sub shift_errors { my ($self) = @_; - my ($err, @errors) = @{$self->error}; + my @errors = @{$self->error}; + my $err = shift(@errors); + $self->{error} = \@errors; + return $err; +} + +=head2 pop_errors + +pops the most recently added error off the error stack and returns it. Returns +nothing if there are no more errors. + +=cut + +sub pop_errors { + my ($self) = @_; + my @errors = @{$self->error}; + my $err = pop(@errors); $self->{error} = \@errors; return $err; } diff --git a/lib/Catalyst/Response.pm b/lib/Catalyst/Response.pm index fa15afb..e87ba61 100644 --- a/lib/Catalyst/Response.pm +++ b/lib/Catalyst/Response.pm @@ -482,6 +482,12 @@ http 1.1 webservers support this). If there is an encoding set, we encode each line of the response (the default encoding is UTF-8). +=head2 $res->unencoded_write( $data ) + +Works just like ->write but we don't apply any content encoding to C<$data>. Use +this if you are already encoding the $data or the data is arriving from an encoded +storage. + =head2 $res->write_fh Returns an instance of L, which is a lightweight diff --git a/lib/Catalyst/RouteMatching.pod b/lib/Catalyst/RouteMatching.pod index 06df601..e5f567c 100644 --- a/lib/Catalyst/RouteMatching.pod +++ b/lib/Catalyst/RouteMatching.pod @@ -87,10 +87,11 @@ is a simple example: use Moose; use MooseX::MethodAttributes; + use MooseX::Types::Moose qw(Int); extends 'Catalyst::Controller'; - sub find :Path('') Args('Int') { + sub find :Path('') Args(Int) { my ($self, $c, $int) = @_; } diff --git a/lib/Catalyst/Runtime.pm b/lib/Catalyst/Runtime.pm index 8332312..6307069 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.90093'; +our $VERSION = '5.90099_001'; $VERSION = eval $VERSION if $VERSION =~ /_/; # numify for warning-free dev releases =head1 NAME diff --git a/lib/Catalyst/Upgrading.pod b/lib/Catalyst/Upgrading.pod index 0d1a60b..094191d 100644 --- a/lib/Catalyst/Upgrading.pod +++ b/lib/Catalyst/Upgrading.pod @@ -2,6 +2,16 @@ Catalyst::Upgrading - Instructions for upgrading to the latest Catalyst +=head1 Upgrading to Catalyst 5.90100 + +The method C in L was actually returning the first error. This has +been fixed but there is a small chance it could be a breaking issue for you. If this gives +you trouble changing to C is the easiest workaround (although that does +modify the error stack so if you are relying on that not being changed you should try something +like @{$c->errors}[-1] instead. Since this method is relatively new and the cases when the +error stack actually has more than one error in it, we feel the exposure is very low, but bug +reports are very welcomed. + =head1 Upgrading to Catalyst 5.90090 L has a new method 'inject_component' which works the same as the method of