On Sat, Jan 03, 2004 at 04:18:51PM +0300, Andrey Brindeew wrote: > How can I set up multiple cookies from template in same request?
It's simple, guys! Just put attached file to APACHE_SERVER_ROOT_DIR/lib/perl/Template/Plugin and read perldoc -F CookieOut.pm :-) -- WBR, Andrey Brindeew. "No one person can understand Perl culture completely" (C) Larry Wall.
#============================================================= -*-Perl-*-
#
# Template::Plugin::CookieOut
#
# DESCRIPTION
#
# Helps to output multiple cookies to client.
#
# AUTHOR
# Andrey Brindeew <[EMAIL PROTECTED]>
#
# COPYRIGHT
# Copyright (C) 2003 Andrey Brindeew.
#
# This module is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
#============================================================================
package Template::Plugin::CookieOut;
require 5.004;
use strict;
use vars qw( $VERSION );
use base qw( Template::Plugin );
use Template::Plugin;
$VERSION = '1.00';
use vars qw(
$r
);
sub new {
my $class = shift;
my $context = shift;
return bless({ r => shift() }, $class);
}
sub add {
my $self = shift;
my $cookie = shift;
$self->{'r'}->headers_out()->add('Set-Cookie' => $cookie);
}
1;
__END__
=head1 NAME
Template::Plugin::CookieOut - helps to output multiple cookies under mod_perl
=head1 SYNOPSIS
[% USE CookieOut(request) %]
[% CookieOut.add('foo=bar; path=/; expires=Tue, 31-Dec-2030 23:59:59 GMT;') %]
[% CookieOut.add('bar=foo; path=/; expires=Tue, 31-Dec-2030 23:59:59 GMT;') %]
=head1 DESCRIPTION
This plugin helps to output multiple cookies from templates under mod_perl
environment.
=head1 AUTHOR
Andrey Brindeew E<lt>[EMAIL PROTECTED]<gt>
L<http://abr.pp.ru/|http://abr.pp.ru/>
=head1 VERSION
1.00
=head1 COPYRIGHT
Copyright (C) 2003 Andrey Brindeew. All Rights Reserved.
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=head1 SEE ALSO
L<Template::Plugin|Template::Plugin>
pgp00000.pgp
Description: PGP signature
