1 |
3 |
ahitrov@rambler.ru |
<%args> |
2 |
|
|
$name |
3 |
|
|
$value => undef |
4 |
|
|
$expires => undef |
5 |
|
|
</%args> |
6 |
|
|
<%init> |
7 |
|
|
if (defined $value) |
8 |
|
|
{ |
9 |
|
|
my $cookie = new CGI::Cookie ( |
10 |
|
|
## -domain => '.rambler.ru', |
11 |
|
|
-name => $name, |
12 |
|
|
-value => $value, |
13 |
|
|
defined $expires ? (-expires => $expires) : (), |
14 |
|
|
-secure => 0, |
15 |
|
|
); |
16 |
|
|
$r->headers_out->add('Set-cookie' => $cookie); |
17 |
|
|
} |
18 |
|
|
else |
19 |
|
|
{ |
20 |
|
|
my %cookies = fetch CGI::Cookie; |
21 |
|
|
my $value = $cookies{$name}->value() if exists $cookies{$name} && $cookies{$name}; |
22 |
|
|
return $value; |
23 |
|
|
} |
24 |
|
|
</%init> |