DOKK / manpages / debian 12 / libmojolicious-perl / Mojo::Cookie.3pm.en
Mojo::Cookie(3pm) User Contributed Perl Documentation Mojo::Cookie(3pm)

Mojo::Cookie - HTTP cookie base class

  package Mojo::Cookie::MyCookie;
  use Mojo::Base 'Mojo::Cookie';
  sub parse     {...}
  sub to_string {...}

Mojo::Cookie is an abstract base class for HTTP cookie containers, based on RFC 6265 <https://tools.ietf.org/html/rfc6265>, like Mojo::Cookie::Request and Mojo::Cookie::Response.

Mojo::Cookie implements the following attributes.

  my $name = $cookie->name;
  $cookie  = $cookie->name('foo');

Cookie name.

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

Cookie value.

Mojo::Cookie inherits all methods from Mojo::Base and implements the following new ones.

  my $cookies = $cookie->parse($str);

Parse cookies. Meant to be overloaded in a subclass.

  my $str = $cookie->to_string;

Render cookie. Meant to be overloaded in a subclass.

Mojo::Cookie overloads the following operators.

  my $bool = !!$cookie;

Always true.

  my $str = "$cookie";

Alias for "to_string".

Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.

2022-12-22 perl v5.36.0