GX::HTTP::Response::Cookie

Module Version: 0.2000_01

NAME

GX::HTTP::Response::Cookie - HTTP response cookie class

SYNOPSIS

# Load the class
use GX::HTTP::Response::Cookie;

# Create a new cookie object
$cookie = GX::HTTP::Response::Cookie->new(
name => 'Customer',
value => 'Wile E. Coyote',
path => '/acme'
)

# Parse a "Set-Cookie" header
@cookies = GX::HTTP::Response::Cookie->parse(
'Customer="Wile E. Coyote"; Path="/acme"; Version="1"'
);

DESCRIPTION

This module provides the GX::HTTP::Response::Cookie class which extends the GX::HTTP::Cookie class.

METHODS

Constructor

new

Returns a new GX::HTTP::Response::Cookie object.

$cookie = GX::HTTP::Response::Cookie->new( %attributes );
Attributes:
  • comment ( string )
  • comment_url ( string )
  • discard ( bool )
  • domain ( string )
  • expires ( string )

    The given value must be in the "Wdy, DD-Mon-YYYY HH:MM:SS GMT" format.

  • http_only ( bool )
  • max_age ( string )
  • name ( string )
  • path ( string )
  • port ( string )
  • secure ( bool )
  • value ( string )
  • version ( string )
Returns:
Exceptions:

Also see parse().

Public Methods

as_string

Returns a string representation of the cookie, suitable for inclusion in a "Set-Cookie" or "Set-Cookie2" header.

$string = $cookie->as_string;
Returns:
  • $string ( string )

comment

Returns / sets the value of the cookie's "Comment" attribute.

$comment = $cookie->comment;
$comment = $cookie->comment( $comment );
Arguments:
  • $comment ( string | undef ) [ optional ]
Returns:
  • $comment ( string | undef )

comment_url

Returns / sets the value of the cookie's "CommentURL" attribute.

$comment_url = $cookie->comment_url;
$comment_url = $cookie->comment_url( $comment_url );
Arguments:
  • $comment_url ( string | undef ) [ optional ]
Returns:
  • $comment_url ( string | undef )

discard

Returns / sets the cookie's "Discard" flag.

$bool = $cookie->discard;
$bool = $cookie->discard( $bool );
Arguments:
  • $bool ( bool ) [ optional ]
Returns:
  • $bool ( bool )

domain

See GX::HTTP::Cookie.

expires

Returns / sets the value of the cookie's "Expires" attribute.

$expires = $cookie->expires;
$expires = $cookie->expires( $expires );
Arguments:
  • $expires ( string | undef ) [ optional ]

    The given value must be in the "Wdy, DD-Mon-YYYY HH:MM:SS GMT" format.

Returns:
  • $expires ( string | undef )

http_only

Returns / sets the cookie's "HttpOnly" flag.

$bool = $cookie->http_only;
$bool = $cookie->http_only( $bool );
Arguments:
  • $bool ( bool ) [ optional ]
Returns:
  • $bool ( bool )

max_age

Returns / sets the value of the cookie's "Max-Age" attribute.

$max_age = $cookie->max_age;
$max_age = $cookie->max_age( $max_age );
Arguments:
  • $max_age ( string | undef ) [ optional ]
Returns:
  • $max_age ( string | undef )

parse

Parses the value of a "Set-Cookie" (or "Set-Cookie2") header into a list of GX::HTTP::Response::Cookie objects.

@cookies = GX::HTTP::Response::Cookie->parse( $string );
Arguments:
  • $string ( string )
Returns:
Exceptions:

secure

Returns / sets the cookie's "Secure" flag.

$bool = $cookie->secure;
$bool = $cookie->secure( $bool );
Arguments:
  • $bool ( bool ) [ optional ]
Returns:
  • $bool ( bool )

version

See GX::HTTP::Cookie.

AUTHOR

Jörg A. Uzarek <uzarek@runlevelnull.de>

COPYRIGHT AND LICENSE

Copyright © 2009-2011 Jörg A. Uzarek.

This module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation.