1 |
622 |
ahitrov |
<%once> |
2 |
|
|
|
3 |
|
|
use Apache::Cookie; |
4 |
|
|
|
5 |
|
|
</%once> |
6 |
8 |
ahitrov@rambler.ru |
<%args> |
7 |
|
|
$name |
8 |
|
|
$value => undef |
9 |
|
|
$expires => undef |
10 |
|
|
</%args> |
11 |
|
|
<%init> |
12 |
601 |
ahitrov |
|
13 |
|
|
if (defined $value) { |
14 |
|
|
my $cookie = Apache::Cookie->new( $request->r(), |
15 |
8 |
ahitrov@rambler.ru |
-name => $name, |
16 |
|
|
-value => $value, |
17 |
|
|
defined $expires ? (-expires => $expires) : (), |
18 |
|
|
-secure => 0, |
19 |
|
|
); |
20 |
601 |
ahitrov |
$cookie->bake(); |
21 |
|
|
} else { |
22 |
|
|
my %cookies = Apache::Cookie->fetch; |
23 |
|
|
my $value = $cookies{$name}->value() if exists $cookies{$name} && $cookies{$name}; |
24 |
|
|
return $value; |
25 |
|
|
} |
26 |
|
|
|
27 |
8 |
ahitrov@rambler.ru |
</%init> |