Mojo::Cookie(3pm)

Mojo::Cookie3pm

Http cookie base class

Usage

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

Overview

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.

Attributes

Mojo::Cookie implements the following attributes.

name

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

Cookie name.

value

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

Cookie value.

Methods

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

parse

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

Parse cookies. Meant to be overloaded in a subclass.

to_string

  my $str = $cookie->to_string;

Render cookie. Meant to be overloaded in a subclass.

Operators

Mojo::Cookie overloads the following operators.

bool

  my $bool = !!$cookie;

Always true.

stringify

  my $str = "$cookie";

Alias for "to_string".

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 7 times.

  1. 6.0
  2. 7
  3. 8
  4. 9
  5. 10
  6. 11
  7. 12
  8. 13

From libmojolicious-perl 9.39+dfsg-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.