Name

SPVM::Mojo::Cookie::Response - HTTP response cookie

Description

Mojo::Cookie::Response class in SPVM a container for HTTP response cookies, based on RFC 6265.

Usage

use Mojo::Cookie::Response;

my $cookie = Mojo::Cookie::Response->new;
$cookie->set_name("foo");
$cookie->set_value("bar");
say $cookie->to_string;

Super Class

Mojo::Cookie

Fields

domain

has domain : rw string;

Cookie domain.

expires

has expires : rw long;

Expiration for cookie.

host_only

has host_only : rw byte;

Host-only flag, indicating that the canonicalized request-host is identical to the cookie's "domain".

httponly

has httponly : rw byte;

HttpOnly flag, which can prevent client-side scripts from accessing this cookie.

max_age

has max_age : rw int;

Max age for cookie.

path

has path : rw string;

Cookie path.

samesite

has samesite : rw string;

SameSite value. Note that this attribute is EXPERIMENTAL because even though most commonly used browsers support the feature, there is no specification yet besides this draft.

secure

has secure : rw byte;

Secure flag, which instructs browsers to only send this cookie over HTTPS connections.

Class Methods

new

static method new : Mojo::Cookie::Response ();

Creates a new Mojo::Cookie::Response object, and returns it.

Instance Methods

parse

method parse : Mojo::Cookie::Response[] ($string : string);

Parses the string $string into the array of Mojo::Cookie::Response objects, and returns it.

Examples:

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

to_string

method to_string : string ();

Renders the cookie to a string and returns it.

Examples:

my $str = $cookie->to_string;

See Also

SPVM::Mojolicious

Copyright & License

Copyright (c) 2025 Yuki Kimoto

MIT License