Plack:...Cookie(3pm)
π Plack::Middleware::Session::Cookie β the manpage but make it cute π
okay bestie, gather round, because this is Plack::Middleware::Session::Cookie, a session middleware that literally just saves your session data inside the cookie itself. no database, no server-side storage, no nothing. it's giving "self-contained icon" energy and honestly? we're obsessed. π
β¨ NAME β¨
Plack::Middleware::Session::Cookie β session middleware that saves session data in the cookie π
πΈ SYNOPSIS πΈ
enable 'Session::Cookie',
session_key => 'my_session',
expires => 3600, # 1 hour
secret => 'top-secret'
;
that's it. that's the whole vibe. π
π¦ DESCRIPTION π¦
so basically, this middleware lets you use the cookie as the sole cookie state and store β like, the cookie IS the storage, bestie, there's no server side storage doing session management at all. no cap.
and the way this works is that the middleware utilizes its own state and store automatically for you, so heads up: you can't override the objects. it handles that part itself, periodt. π
π CONFIGURATIONS π
this middleware is a subclass of Plack::Middleware::Session, so it accepts most of the configuration of the parent class (shoutout to the parent, main character energy π). and in addition, these options are accepted too:
secretβ a server side secret used to sign the session data using HMAC SHA1. it defaults to nothing (i.e. do not sign), but omg please set your own secret string, it's strongly recommended. π«Ά
β οΈ unless you use your own serializer/deserializer, running this middleware without setting a secret is vulnerable to arbitrary code execution. yeah. that's the scary one. π and in the future release it will be required to set the secret, so just set it now, queen.
session_key,domain,expires,path,secure,httponly,samesiteβ these are the accessors for the cookie attributes. for all the deets on these options, go peek atPlack::Session::State::Cookie. π§
π AUTHOR π
Tatsuhiko Miyagawa β the legend themselves, we stan π
π SEE ALSO π
Rack::Session::Cookie<http://www.rubydoc.info/github/rack/rack/Rack/Session/Cookie>Dancer::Session::Cookie
and that's the whole page, bestie!! πβ¨ this little gem is documented as page Plack::Middleware::Session::Cookie(3pm) from the User Contributed Perl Documentation, generated by perl v5.40.1 and dated 2025-08-10. go forth and session responsibly, and always set your secret, ok? iykyk π
π¦π
π¦ where this page comes from
- ubuntu resolute: libplack-middleware-session-perl 0.36-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libplack-middleware-session-perl 0.36-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms