本当にただのメモ

なるべく Qiita に投稿しよう

Plack で Set-Cookie

https://metacpan.org/pod/Plack::Response#cookies に書いてあるとおりだけども。

my $app = sub {
    my $res = Plack::Response->new(200);

    $res->cookies->{foo} = 123;
    $res->cookies->{bar} = { value => '123' };
    $res->cookies->{baz} = {
        value => 'test',
        path  => "/",
        domain => '.example.com',
        expires => time + 24 * 60 * 60,
    };

    $res->finalize;
}
200 OK
Set-Cookie: foo=123
Set-Cookie: bar=123
Set-Cookie: baz=test; domain=.example.com; path=/; expires=Wed, 16-May-2018 02:04:46 GMT