# This file documents the revision history for Perl extension Catalyst.
-5.90099 - 2015-08-XX
+5.90100 - 2015-08-24
- Document using namespace::autoclean with controllers that have actions
with type constraints.
- Look for type constraints in super classes and consumed roles.
- Change the way the stash middleware works to no longer localize $psgi_env.
+ - If you delegate control to a sub Catalyst application, that application
+ may now return information to the parent application via the stash.
5.90098 - 2015-08-11
- Fix for RT#106373 (Issue when you try to install and also have an old
__PACKAGE__->_encode_check(Encode::FB_CROAK | Encode::LEAVE_SRC);
# Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.90098';
+our $VERSION = '5.90100';
$VERSION = eval $VERSION if $VERSION =~ /_/; # numify for warning-free dev releases
sub import {
This is an overview of the user-visible changes to Catalyst between major
Catalyst releases.
+=head2 VERSION 5.90100
+
+Support for type constraints in Args and CaptureArgs has been improved. You may
+now inherit from a base controller that declares type constraints and use roles
+that declare type constraints. See L<Catalyst::RouteMatching> for more.
+
+You may now. also use a full type constraint namespace instead of inporting type
+constraints into your package namespace.
+
+We changed the way the middleware stash works so that it no longer localizes
+the PSGI env hashref. This was done to fix bugs where people set PSGI ENV hash
+keys and found them to dissappear in certain cases. It also means that now if
+a sub applications sets stash variables, that stash will now bubble up to the
+parent application. This may be a breaking change for you since previous
+versions of this code did not allow that. A workaround is to explicitly delete
+stash keys in your sub application before returning control to the parent
+application.
+
=head2 VERSION 5.90097
=head3 Defined how $c->uri_for adds a URI fragment.
our @EXPORT_OK = qw(stash get_stash);
-sub PSGI_KEY () { 'Catalyst.Stash.v1' }
+sub PSGI_KEY () { 'Catalyst.Stash.v2' }
sub get_stash {
my $env = shift;
}
sub _create_stash {
+ my $self = shift;
my $stash = shift || +{};
return sub {
if(@_) {
sub call {
my ($self, $env) = @_;
- my $new_env = +{ %$env };
- my %stash = %{ ($env->{+PSGI_KEY} || sub {})->() || +{} };
+ $env->{+PSGI_KEY} = $self->_create_stash
+ unless exists($env->{+PSGI_KEY});
- $env->{+PSGI_KEY} = _create_stash( \%stash );
return $self->app->($env);
}
We store a coderef under the C<PSGI_KEY> which can be dereferenced with
key values or nothing to access the underlying hashref.
-The stash middleware is designed so that you can 'nest' applications that
-use it. If for example you have a L<Catalyst> application that is called
-by a controller under a parent L<Catalyst> application, the child application
-will inherit the full stash of the parent BUT any new keys added by the child
-will NOT bubble back up to the parent. However, children of children will.
+Anything placed into the stash will be available in the stash of any 'mounted'
+Catalyst applictions. A mounted Catalyst application may set the stash and
+'pass back' information to the parent application. Non Catalyst applications
+may use this middleware to access and set stash values.
+
+Please note I highly recommend having a stronger interface than a stash key
+between applications.
For more information the current test case t/middleware-stash.t is the best
documentation.
# Remember to update this in Catalyst as well!
-our $VERSION = '5.90098';
+our $VERSION = '5.90100';
$VERSION = eval $VERSION if $VERSION =~ /_/; # numify for warning-free dev releases
=head1 NAME
Catalyst::Upgrading - Instructions for upgrading to the latest Catalyst
+=head1 Upgrading to Catalyst 5.90100
+
+We changed the way the middleware stash works so that it no longer localizes
+the PSGI env hashref. This was done to fix bugs where people set PSGI ENV hash
+keys and found them to dissappear in certain cases. It also means that now if
+a sub applications sets stash variables, that stash will now bubble up to the
+parent application. This may be a breaking change for you since previous
+versions of this code did not allow that. A workaround is to explicitly delete
+stash keys in your sub application before returning control to the parent
+application.
+
=head1 Upgrading to Catalyst 5.90097
In older versions of Catalyst one could construct a L<URI> with a fragment (such as
$c->stash->{outer} = "outer";
$c->res->from_psgi_response( MyAppChild->to_app->($c->req->env) );
- is_deeply [keys(%{$c->stash})], ['outer'], 'only one key in stash';
+ is_deeply [sort keys(%{$c->stash})], ['inner','outer'];
}
package MyAppParent;
use Catalyst;
+ MyAppParent->config(psgi_middleware=>['+MyMiddleware']);
MyAppParent->setup;
}