Revision 622 (by ahitrov, 2016/11/11 15:39:01) use required...

<%once>

    use Apache::Cookie;

</%once>
<%args>
	$name
	$value => undef
	$expires => undef
</%args>
<%init>

    if (defined $value) {
	my $cookie = Apache::Cookie->new( $request->r(),
			-name 	=> $name,
			-value 	=> $value,
			defined $expires ? (-expires => $expires) : (),
			-secure => 0,
		);
	$cookie->bake();
    } else {
	my %cookies = Apache::Cookie->fetch;
	my $value = $cookies{$name}->value()	if exists $cookies{$name} && $cookies{$name};
	return $value;
    }

</%init>