Merge branch 'abort-chain-doc-and-test' of https://github.com/melmothx/catalyst-runti...
John Napiorkowski [Mon, 1 May 2017 14:24:39 +0000 (09:24 -0500)]
1  2 
lib/Catalyst.pm

diff --combined lib/Catalyst.pm
@@@ -51,7 -51,6 +51,7 @@@ use Catalyst::Middleware::Stash
  use Plack::Util;
  use Class::Load 'load_class';
  use Encode 2.21 'decode_utf8', 'encode_utf8';
 +use Scalar::Util;
  
  BEGIN { require 5.008003; }
  
@@@ -205,7 -204,7 +205,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.90112';
 +our $VERSION = '5.90114';
  $VERSION = eval $VERSION if $VERSION =~ /_/; # numify for warning-free dev releases
  
  sub import {
@@@ -475,7 -474,7 +475,7 @@@ or stash it like so
  
  and access it from the stash.
  
 -Keep in mind that the C<end> method used is that of the caller action. So a C<$c-E<gt>detach> inside a forwarded action would run the C<end> method from the original action requested.
 +Keep in mind that the C<end> method used is that of the caller action. So a C<< $c->detach >> inside a forwarded action would run the C<end> method from the original action requested.
  
  =cut
  
@@@ -2322,10 -2321,6 +2322,10 @@@ sub finalize_encoding 
        (defined($res->body)) and
        (ref(\$res->body) eq 'SCALAR')
      ) {
 +        # if you are finding yourself here and your body is already encoded correctly
 +        # and you want to turn this off, use $c->clear_encoding to prevent encoding
 +        # at this step, or set encoding to undef in the config to do so for the whole
 +        # application.  See the ENCODING documentaiton for better notes.
          $c->res->body( $c->encoding->encode( $c->res->body, $c->_encode_check ) );
  
          # Set the charset if necessary.  This might be a bit bonkers since encodable response
@@@ -2495,8 -2490,6 +2495,8 @@@ sub prepare 
      };
  
      $c->log_request;
 +    $c->{stash} = $c->stash;
 +    Scalar::Util::weaken($c->{stash});
  
      return $c;
  }
@@@ -4304,18 -4297,20 +4304,20 @@@ value to undef
  
  C<abort_chain_on_error_fix>
  
- When there is an error in an action chain, the default behavior is to continue
- processing the remaining actions and then catch the error upon chain end.  This
- can lead to running actions when the application is in an unexpected state.  If
- you have this issue, setting this config value to true will promptly exit a
- chain when there is an error raised in any action (thus terminating the chain
- early.)
+ Defaults to true.
  
- use like:
+ When there is an error in an action chain, the default behavior is to
+ abort the processing of the remaining actions to avoid running them
+ when the application is in an unexpected state.
  
-     __PACKAGE__->config(abort_chain_on_error_fix => 1);
+ Before version 5.90070, the default used to be false. To keep the old
+ behaviour, you can explicitely set the value to false. E.g.
+     __PACKAGE__->config(abort_chain_on_error_fix => 0);
+ If this setting is set to false, then the remaining actions are
+ performed and the error is caught at the end of the chain.
  
- In the future this might become the default behavior.
  
  =item *
  
@@@ -4769,11 -4764,6 +4771,11 @@@ the encoding configuration to undef
  
  This is recommended for temporary backwards compatibility only.
  
 +To turn it off for a single request use the L<clear_encoding>
 +method to turn off encoding for this request.  This can be useful
 +when you are setting the body to be an arbitrary block of bytes,
 +especially if that block happens to be a block of UTF8 text.
 +
  Encoding is automatically applied when the content-type is set to
  a type that can be encoded.  Currently we encode when the content type
  matches the following regular expression:
@@@ -4896,7 -4886,7 +4898,7 @@@ andrewalker: AndrĂ© Walker <andre@cpan.
  
  Andrew Bramble
  
 -Andrew Ford E<lt>A.Ford@ford-mason.co.ukE<gt>
 +Andrew Ford <A.Ford@ford-mason.co.uk>
  
  Andrew Ruthven
  
@@@ -4920,7 -4910,7 +4922,7 @@@ Danijel Milicevic C<me@danijel.de
  
  davewood: David Schmidt <davewood@cpan.org>
  
 -David Kamholz E<lt>dkamholz@cpan.orgE<gt>
 +David Kamholz <dkamholz@cpan.org>
  
  David Naughton, C<naughton@umn.edu>