CGI::Cookie - Interface to HTTP Cookies - metacpan.org
以下の通り
1個の場合
#!/usr/local/bin/perl use strict; use warnings; use CGI; use CGI::Cookie; main(); sub main { my $cgi = CGI->new(); my $cookie_1 = CGI::Cookie->new(-name => 'key_1', -value => 'val_1', -httponly=> 0); print CGI::header(-type=>'text/html',-charset=>'UTF-8', -cookie=>$cookie_1); : }
複数個の場合
#!/usr/local/bin/perl use strict; use warnings; use CGI; use CGI::Cookie; main(); sub main { my $cgi = CGI->new(); my $cookie_1 = CGI::Cookie->new(-name => 'key_1', -value => 'val_1', -httponly=> 0); my $cookie_2 = CGI::Cookie->new(-name => 'key_2', -value => 'val_2', -httponly=> 1); print CGI::header(-type=>'text/html',-charset=>'UTF-8', -cookie=>[$cookie_1,$cookie_2]); : }