GX::HTTP::Cookies

Module Version: 0.2000_01

NAME

GX::HTTP::Cookies - Container class for GX::HTTP::Cookie objects

SYNOPSIS

# Load the class
use GX::HTTP::Cookies;

# Create a new container object
$cookies = GX::HTTP::Cookies->new;

# Add a cookie
$cookies->add(
GX::HTTP::Request::Cookie->new(
name => 'customer',
value => 'Wile E. Coyote'
)
);

# Retrieve a cookie
$cookie = $cookies->get( 'customer' );

DESCRIPTION

This module provides the GX::HTTP::Cookies class which extends the GX::Class::Object class.

METHODS

Constructor

new

Returns a new GX::HTTP::Cookies object.

$cookies = GX::HTTP::Cookies->new;
Returns:
Exceptions:

Also see GX::HTTP::Request::Cookies and GX::HTTP::Response::Cookies.

Public Methods

add

Adds the given cookie objects to the container.

$cookies->add( @cookies );
Arguments:
Exceptions:

all

Returns all cookie objects in the order they were added.

@cookies = $cookies->all;
Returns:

clear

Empties the container.

$cookies->clear;

count

Returns the number of cookies currently in the container.

$count = $cookies->count;
Returns:
  • $count ( integer )

get

Returns all cookie objects with the specified name in the order they were added.

@cookies = $cookies->get( $name );
Arguments:
  • $name ( string )
Returns:

In scalar context, the first of those cookies is returned.

$cookie = $cookies->get( $name );
Arguments:
  • $name ( string )
Returns:

names

Returns a list with the names of the cookies.

@names = $cookies->names;
Returns:
  • @names ( strings )

remove

Removes all cookies with the specified name(s) from the container.

$result = $cookies->remove( @names );
Arguments:
  • @names ( strings )
Returns:
  • $result ( integer )

    The number of cookies that were removed.

set

Adds the given cookie objects to the container, replacing any previously added cookies with the same name attribute.

$cookies->set( @cookies );
Arguments:
Exceptions:

SUBCLASSES

The following classes inherit directly from GX::HTTP::Cookies:

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.