in reply to HTML::Template and setting Cookies
A sample piece of code from a CGI::Application run-mode subroutine which makes use of this method to set a cookie might look like this:
sub user_login { my $self = shift; my $cgi = $self->query; my $xml = $self->param('xml'); $self->header_props( -uri => '/' ); if ((defined $cgi->param('username')) && (defined $cgi->param('pas +sword'))) { my @user = grep { $_->{'username'} eq $cgi->param('username') +} @{%{$xml}->{'user'}}; if (scalar @user) { my $user = shift @user; if ($user->{password} eq md5_hex($cgi->param('password'))) + { $self->header_props( -cookie => $cgi->cookie( -expires => '+1y', -name => 'cowsnet-auth', -path => '/', -value => \%{$user} ), -uri => '/' ); } } }; $self->header_type('redirect'); }
In this code the Set-Cookie header is set through the -cookie argument which is passed onto CGI - Additionally a Location header is set the header_type is set to redirect the user to the URL specified in the Location header.
In addition to the CGI::Application documentation, you might want to look at the module review on this module here.
perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'
|
|---|