1Catalyst::Middleware::SUtsaesrh(C3o)ntributed Perl DocumCeanttaaltyisotn::Middleware::Stash(3)
2
3
4

NAME

6       Catalyst::Middleware::Stash - The Catalyst stash - in middleware
7

DESCRIPTION

9       We've moved the Catalyst stash to middleware.  Please don't use this
10       directly since it is likely to move off the Catalyst namespace into a
11       stand alone distribution
12
13       We store a coderef under the "PSGI_KEY" which can be dereferenced with
14       key values or nothing to access the underlying hashref.
15
16       Anything placed into the stash will be available in the stash of any
17       'mounted' Catalyst applications.  A mounted Catalyst application may
18       set the stash and 'pass back' information to the parent application.
19       Non Catalyst applications may use this middleware to access and set
20       stash values.
21
22       Please note I highly recommend having a stronger interface than a stash
23       key between applications.
24
25       For more information the current test case t/middleware-stash.t is the
26       best documentation.
27

SUBROUTINES

29       This class defines the following subroutines.
30
31   PSGI_KEY
32       Returns the hash key where we store the stash.  You should not assume
33       the string value here will never change!  Also, its better to use
34       "get_stash" or "stash".
35
36   get_stash
37       Expect: $psgi_env.
38
39       Exportable subroutine.
40
41       Get the stash out of the $env.
42
43   stash
44       Expects: An object that does "env" and arguments
45
46       Exportable subroutine.
47
48       Given an object with a method "env" get or set stash values, either as
49       a method or via hashref modification.  This stash is automatically
50       reset for each request (it is not persistent or shared across connected
51       clients.  Stash key / value are stored in memory.
52
53           use Plack::Request;
54           use Catalyst::Middleware::Stash 'stash';
55
56           my $app = sub {
57             my $env = shift;
58             my $req = Plack::Request->new($env);
59             my $stashed = $req->stash->{in_the_stash};  # Assume the stash was previously populated.
60
61             return [200, ['Content-Type' => 'text/plain'],
62               ["I found $stashed in the stash!"]];
63           };
64
65       If the stash does not yet exist, an exception is thrown.
66

METHODS

68       This class defines the following methods.
69
70   call
71       Used by plack to call the middleware
72
73
74
75perl v5.28.1                      2019-01-18    Catalyst::Middleware::Stash(3)
Impressum