Mojo::C...esponse(3)

🌸 NAME 🌸

Mojo::Cookie::Response β€” it's an HTTP response cookie, bestie πŸ’– (and yes, this is the Mojo::Cookie::Response(3) page straight out of the User Contributed Perl Documentation, so you're in the right place 🫢)

✨ SYNOPSIS ✨

Like, the tiniest little taste of what this thing does πŸ“

use Mojo::Cookie::Response;

my $cookie = Mojo::Cookie::Response->new;
$cookie->name('foo');
$cookie->value('bar');
say "$cookie";

πŸ’… DESCRIPTION πŸ’…

Mojo::Cookie::Response is literally just a container for HTTP response cookies. That's the whole vibe ✨ It's based on RFC 6265 <https://tools.ietf.org/html/rfc6265> β€” no cap, that's the actual spec it follows πŸ‘‘

πŸŽ€ ATTRIBUTES πŸŽ€

Okay so Mojo::Cookie::Response inherits all its attributes from Mojo::Cookie, and then adds these new ones on top. Main character energy honestly πŸ’œ

πŸ¦‹ domain

my $domain = $cookie->domain;
$cookie    = $cookie->domain('localhost');

This is the cookie's domain. Where it lives. Its whole address, iykyk 🏠

🌸 expires

my $expires = $cookie->expires;
$cookie     = $cookie->expires(time + 60);

When the cookie expires β€” the expiration for the cookie. Rude but necessary 😭

⭐ host_only

my $bool = $cookie->host_only;
$cookie  = $cookie->host_only($bool);

The host-only flag, which indicates that the canonicalized request-host is identical to the cookie's domain. Big "same place, same energy" vibes 🫢

🧚 httponly

my $bool = $cookie->httponly;
$cookie  = $cookie->httponly($bool);

The HttpOnly flag β€” and it can prevent client-side scripts from accessing this cookie. Protective queen behavior, we love her πŸ”₯

πŸ“ max_age

my $max_age = $cookie->max_age;
$cookie     = $cookie->max_age(60);

The max age for the cookie. Its little lifespan ⏳

🌈 path

my $path = $cookie->path;
$cookie  = $cookie->path('/test');

The cookie path. Where it's allowed to hang out πŸ›£οΈ

πŸ‘‘ samesite

my $samesite = $cookie->samesite;
$cookie      = $cookie->samesite('Lax');

The SameSite value. That's it, that's the whole attribute πŸ’…

πŸ’– secure

my $bool = $cookie->secure;
$cookie  = $cookie->secure($bool);

The Secure flag, which instructs browsers to only send this cookie over HTTPS connections. No insecure roads for this icon πŸ”


πŸŽ€ METHODS πŸŽ€

Mojo::Cookie::Response inherits all its methods from Mojo::Cookie and then implements these new ones, periodt ✨

πŸ¦‹ parse

my $cookies = Mojo::Cookie::Response->parse('f=b; path=/');

Parse cookies. Boom, cookies, parsed πŸͺ

🌸 to_string

my $str = $cookie->to_string;

Render cookie. Turn it into a string so it can go be a cookie somewhere πŸŽ€

πŸ”₯ SEE ALSO πŸ”₯

  • Mojolicious β€” the whole main quest πŸ‘‘
  • Mojolicious::Guides β€” the reading material, do your homework bestie πŸ“š
  • <https://mojolicious.org> β€” the website, go click around 🌈

Okay that's the whole page, you ate that πŸ’… stay hydrated, stay canonicalized, and remember: this was perl v5.42.0, dated 2026-07-15 β€” mwah, love u, bye πŸ«ΆπŸ’–βœ¨

πŸ“¦ where this page comes from