Line # Revision Author
1 8 ahitrov@rambler.ru <%args>
2
3 $name => undef
4 $value => undef
5 $delete => undef
6
7 </%args>
8 <%init>
9 my $cookie_name = 'content_context';
10
11 if ($name) {
12 my $context = exists $request->{context} ? $request->{context} : {};
13 if ($delete) {
14 delete ($context->{$name});
15 $m->comp('/contenido/components/cookies.msn', name => $cookie_name, value => join('/', map { "$_-$context->{$_}" } keys %$context));
16 return undef;
17 }
18 if (! defined $value) {
19 return $context->{$name} if exists $context->{$name};
20 } else {
21 $context->{$name} = $value;
22 $m->comp('/contenido/components/cookies.msn', name => $cookie_name, value => join('/', map { "$_-$context->{$_}" } keys %$context));
23 }
24 } else {
25 return $request->{context} if exists $request->{context};
26 my %context = map { split /-/ } split('/', $m->comp('/contenido/components/cookies.msn', name => $cookie_name));
27 $request->{context} = \%context;
28 return $request->{context};
29 }
30
31 </%init>