removed a bit more PSGI::Engine backcompat
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Middleware / Stash.pm
CommitLineData
6561feae 1package ## Hide from pause
2 Catalyst::Middleware::Stash;
3
4# Please don't use this, this is likely to go away before stable version is
5# released. Ideally this could be a stand alone distribution.
6#
7
8use strict;
9use warnings;
10use base 'Plack::Middleware';
11
12sub PSGI_KEY { 'Catalyst.Stash.v1' };
13
14sub _init_stash {
15 my ($self, $env) = @_;
16 $env->{&PSGI_KEY} = bless +{}, 'Catalyst::Stash';
17}
18
19sub get {
20 my ($class, $env) = @_;
21 return $env->{&PSGI_KEY};
22}
23
24sub call {
25 my ($self, $env) = @_;
26 $self->_init_stash($env);
27 return $self->app->($env);
28}
29
30=head1 TITLE
31
32Catalyst::Middleware::Stash - The Catalyst stash - in middleware
33
34=head1 DESCRIPTION
35
36We've moved the L<Catalyst> stash to middleware. Please don't use this
37directly since it is likely to move off the Catalyst namespace into a stand
38alone distribution
39
40=head1 METHODS
41
42This class defines the following methods
43
44=head2 PSGI_KEY
45
46Returns the hash key where we store the stash
47
48=head2 get
49
50Get the stash out of the C<$env>
51
52=head2 call
53
54Used by plack to call the middleware
55
56=cut
57
581;