The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

HTTP::Promise::Headers::Cookie - Cookie Header Field

SYNOPSIS

    use HTTP::Promise::Headers::Cookie;
    my $c = HTTP::Promise::Headers::Cookie->new( 'name=value; name2=value2; name3=value3' ) || 
        die( HTTP::Promise::Headers::Cookie->error, "\n" );
    # or
    my $c = HTTP::Promise::Headers::Cookie->new( [qw( name=value name2=value2 name3=value3 )] );
    $c->cookies->push( 'name4=value4' );
    $c->cookies->remove( 'name2=value2' );
    say "$c";
    # This would return: name=value; name3=value3; name4=value4

VERSION

    v0.1.0

DESCRIPTION

HTTP::Promise::Headers::Cookie implements a simple interface to store the cookie name-value pairs sent by the user agent to the server. It uses "cookies" which returns a Module::Generic::Array to manage and contain all the cookie name-value pairs. It is up to you to provide the right cookie string.

You can and maybe should use Cookie::Jar to help you manage a cookie jar and format cookies.

CONSTRUCTOR

new

Provided with an optional string or array reference and this will instantiate a new object and return it.

If a string is provided, it is expected to be properly formatted, such as:

    name=value; name2=value2; name3=value3

It will be properly split and added to "cookies". If an array is provided, it will be directly added to "cookies".

METHODS

as_string

Returns a string representation for this Cookie header field.

cookies

Returns an array object containing all the cookies.

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Cookie, Cookie::Jar, rfc6265, section 5.4 and Mozilla documentation

HTTP::Promise, HTTP::Promise::Request, HTTP::Promise::Response, HTTP::Promise::Message, HTTP::Promise::Entity, HTTP::Promise::Headers, HTTP::Promise::Body, HTTP::Promise::Body::Form, HTTP::Promise::Body::Form::Data, HTTP::Promise::Body::Form::Field, HTTP::Promise::Status, HTTP::Promise::MIME, HTTP::Promise::Parser, HTTP::Promise::IO, HTTP::Promise::Stream, HTTP::Promise::Exception

COPYRIGHT & LICENSE

Copyright(c) 2022 DEGUEST Pte. Ltd.

All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.