GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  COOKIE::BAKER (3)

.ds Aq ’

NAME

Cookie::Baker - Cookie string generator / parser

CONTENTS

SYNOPSIS



    use Cookie::Baker;

    $headers->push_header(Set-Cookie, bake_cookie($key,$val));

    my $cookies_hashref = crush_cookie($headers->header(Cookie));



DESCRIPTION

Cookie::Baker provides simple cookie string generator and parser.

XS IMPLEMENTATION

This module tries to use Cookie::Baker::XS’s crush_cookie by default. If this fails, it will use Cookie::Baker’s pure Perl crush_cookie.

There is no XS implementation of bake_cookie yet.

FUNCTION

bake_cookie


  my $cookie = bake_cookie(foo,val);
  my $cookie = bake_cookie(foo, {
      value => val,
      path => "test",
      domain => .example.com,
      expires => +24h
  } );



Generates a cookie string for an HTTP response header. The first argument is the cookie’s name and the second argument is a plain string or hash reference that can contain keys such as value, domain, expires, path, httponly, secure, max-age.
value Cookie’s value
domain Cookie’s domain.
expires Cookie’s expires date time. Several formats are supported



  expires => time + 24 * 60 * 60 # epoch time
  expires => Wed, 03-Nov-2010 20:54:16 GMT
  expires => +30s # 30 seconds from now
  expires => +10m # ten minutes from now
  expires => +1h  # one hour from now
  expires => -1d  # yesterday (i.e. "ASAP!")
  expires => +3M  # in three months
  expires => +10y # in ten years time
  expires => now  #immediately



path Cookie’s path.
httponly If true, sets HttpOnly flag. false by default.
secure If true, sets secure flag. false by default.

crush_cookie Parses cookie string and returns a hashref.



    my $cookies_hashref = crush_cookie($headers->header(Cookie));
    my $cookie_value = $cookies_hashref->{cookie_name}



SEE ALSO

CPAN already has many cookie related modules. But there is no simple cookie string generator and parser module.

CGI, CGI::Simple, Plack, Dancer::Cookie

LICENSE

Copyright (C) Masahiro Nagano.

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

AUTHOR

Masahiro Nagano <kazeburo@gmail.com>
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 COOKIE::BAKER (3) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.