1Dancer::Cookies(3) User Contributed Perl Documentation Dancer::Cookies(3)
2
3
4
6 Dancer::Cookies - a singleton storage for all cookies
7
9 version 1.3521
10
12 use Dancer::Cookies;
13
14 my $cookies = Dancer::Cookies->cookies;
15
16 foreach my $name ( keys %{$cookies} ) {
17 my $cookie = $cookies->{$name};
18 my $value = $cookie->value;
19 print "$name => $value\n";
20 }
21
22
23 cookie lang => "fr-FR"; #set a cookie and return its value
24 cookie lang => "fr-FR", expires => "2 hours";
25 cookie "lang" #return a cookie value
26
28 Dancer::Cookies keeps all the cookies defined by the application and
29 makes them accessible and provides a few helper functions for cookie
30 handling with regards to the stored cookies.
31
33 init
34 This method is called when "->new()" is called. It creates a storage of
35 cookies parsed from the environment using "parse_cookies_from_env"
36 described below.
37
38 cookies
39 Returns a hash reference of all cookies, all objects of Dancer::Cookie
40 type.
41
42 The key is the cookie name, the value is the Dancer::Cookie object.
43
44 cookie
45 "cookie" method is useful to query or set cookies easily.
46
47 cookie lang => "fr-FR"; # set a cookie and return its value
48 cookie lang => "fr-FR", expires => "2 hours"; # extra cookie info
49 cookie "lang" # return a cookie value
50
51 parse_cookie_from_env
52 Fetches all the cookies from the environment, parses them and creates a
53 hashref of all cookies.
54
55 It also returns all the hashref it created.
56
58 Dancer Core Developers
59
61 This software is copyright (c) 2010 by Alexis Sukrieh.
62
63 This is free software; you can redistribute it and/or modify it under
64 the same terms as the Perl 5 programming language system itself.
65
66
67
68perl v5.36.0 2023-02-09 Dancer::Cookies(3)