Sending Multiple Cookies Using CGI.pm : Cookie « CGI « Perl






Sending Multiple Cookies Using CGI.pm

    


#!/usr/bin/perl -T

use strict;
use CGI qw/:standard/;

my $cookie1 = cookie(-name=>'testcookie',value=>'testcookievalue',expires=>'+7d');
my $cookie2 = cookie(-name=>'secondcookie',value=>'secondcookievalue',expires=>'+1d');
print header (-cookie=>[$cookie1,$cookie2]),start_html('CGI Cookie Test'),p("You've received a cookie\n"),
end_html;

exit;

   
    
    
    
  








Related examples in the same category

1.A Simple Cookie Example
2.A Simple Cookie Example Using the CGI Module
3.Retrieving Cookies
4.Setting Cookie Expiration Without Using the CGI Module
5.Setting Cookie Expiration Using the CGI Module
6.Retrieving Multiple Cookies
7.Create cookie
8.Cookies and Session Tracking
9.Session tracking in our CGI scripts
10.Read cookie value
11.Program to read cookies from the client's computer
12.Time Period Abbreviations for the CGI Module's Header and Cookie Functions