Uh...try this?
common.cgi
#!/usr/bin/perl
####################################
use CGI qw/:standard/;
use CGI::Cookie;
sub write_cookie
{
my $c = new CGI::Cookie(-name => 'foo',
-value => ['bar','baz'],
-expires => '+3M'
);
print header(-cookie=>[$c]);
%cookies = fetch CGI::Cookie;
## This is very bad. You should check that $cookies{'ID'} exists
## or your script will die when you run this code.
# $id = $cookies{'ID'}->value;
## You've already filled %cookies with the cookies. Why
## do it again?
# %cookies = parse CGI::Cookie($ENV{COOKIE});
}
1;
script.pl
#!/usr/bin/perl
require "common.cgi";
write_cookie();
print "Something";
antirice
The first rule of Perl club is - use Perl
The ith rule of Perl club is - follow rule i - 1 for i > 1