Plack:...:Cookie(3pm)

okay bestie, it's Plack::Session::State::Cookie β€” the Basic cookie-based session state situation. it's giving "User Contributed Perl Documentation", it's giving "Plack:...:Cookie(3pm)", and honestly? iconic.


✨ NAME ✨

Plack::Session::State::Cookie β€” basic cookie-based session state, no cap πŸͺ


🌸 SYNOPSIS 🌸

use Plack::Builder;
use Plack::Middleware::Session;

my $app = sub {
    return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello Foo' ] ];
};

builder {
    enable 'Session'; # Cookie is the default state
    $app;
};

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically, this is a subclass of Plack::Session::State and it implements its full interface β€” the whole thing, periodt. and plot twist: this is the default state used in Plack::Middleware::Session. so when you just enable 'Session' and don't say anything else, THIS is the girl running the show πŸ‘‘


πŸŽ€ METHODS πŸŽ€

  • new ( %params ) β€” the constructor, obvi. the %params can include path, domain, expires, secure, and httponly options, plus all the options accepted by Plack::Session::State. yes, all of them. she's generous πŸ’…
  • path β€” path of the cookie, and this defaults to "/".
  • domain β€” domain of the cookie. if nothing is supplied, then it will not be included in the cookie. so it's optional, and staying quiet is a valid choice 🫢
  • expires β€” expiration time of the cookie, in seconds. if nothing is supplied, then it will not be included in the cookie, which means the session expires per browser session. so basically, no option = the session dips when your browser dips 😭
  • secure β€” secure flag for the cookie. if nothing is supplied, then it will not be included in the cookie.
  • httponly β€” HttpOnly flag for the cookie. if nothing is supplied, then it will not be included in the cookie.
  • samesite β€” SameSite flag for the cookie. if nothing is supplied, then it will not be included in the cookie. (yes she's here too, don't skip her 🌈)
little vibe check: new lists path, domain, expires, secure, and httponly for %params β€” and samesite still gets its own method below. i'm just saying what the page says, bestie, i don't make the rules πŸ™ˆ

πŸ’€ BUGS πŸ’€

all complex software has bugs lurking in it, and this module is no exception. if you find a bug please either email me, or add the bug to cpan-RT. not me asking you to snitch on the bugs, but like… please do 🌸


πŸ‘‘ AUTHOR πŸ‘‘

Stevan Little <stevan.little@iinteractive.com> β€” we stan ✨


Copyright 2009, 2010 Infinity Interactive, Inc.

http://www.iinteractive.com

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


okay that's the whole page, you ate it, you're a Unix main character now 🧚 slay. this was brought to you by user-contributed Perl docs, perl v5.40.1, dated 2025-08-10, under the Plack:...:Cookie(3pm) header β€” mwah, take care of her, bye bestie πŸŽ€πŸ’–

πŸ“¦ where this page comes from