.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Catalyst::Middleware::Stash 3pm" .TH Catalyst::Middleware::Stash 3pm "2023-09-28" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Catalyst::Middleware::Stash \- The Catalyst stash \- in middleware .SH "DESCRIPTION" .IX Header "DESCRIPTION" We've moved the Catalyst stash to middleware. Please don't use this directly since it is likely to move off the Catalyst namespace into a stand alone distribution .PP We store a coderef under the \f(CW\*(C`PSGI_KEY\*(C'\fR which can be dereferenced with key values or nothing to access the underlying hashref. .PP Anything placed into the stash will be available in the stash of any 'mounted' Catalyst applications. 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. .PP Please note I highly recommend having a stronger interface than a stash key between applications. .PP For more information the current test case t/middleware\-stash.t is the best documentation. .SH "SUBROUTINES" .IX Header "SUBROUTINES" This class defines the following subroutines. .SS "\s-1PSGI_KEY\s0" .IX Subsection "PSGI_KEY" Returns the hash key where we store the stash. You should not assume the string value here will never change! Also, its better to use \&\*(L"get_stash\*(R" or \*(L"stash\*(R". .SS "get_stash" .IX Subsection "get_stash" Expect: \f(CW$psgi_env\fR. .PP Exportable subroutine. .PP Get the stash out of the \f(CW$env\fR. .SS "stash" .IX Subsection "stash" Expects: An object that does \f(CW\*(C`env\*(C'\fR and arguments .PP Exportable subroutine. .PP Given an object with a method \f(CW\*(C`env\*(C'\fR get or set stash values, either as a method or via hashref modification. This stash is automatically reset for each request (it is not persistent or shared across connected clients. Stash key / value are stored in memory. .PP .Vb 2 \& use Plack::Request; \& use Catalyst::Middleware::Stash \*(Aqstash\*(Aq; \& \& my $app = sub { \& my $env = shift; \& my $req = Plack::Request\->new($env); \& my $stashed = $req\->stash\->{in_the_stash}; # Assume the stash was previously populated. \& \& return [200, [\*(AqContent\-Type\*(Aq => \*(Aqtext/plain\*(Aq], \& ["I found $stashed in the stash!"]]; \& }; .Ve .PP If the stash does not yet exist, an exception is thrown. .SH "METHODS" .IX Header "METHODS" This class defines the following methods. .SS "call" .IX Subsection "call" Used by plack to call the middleware