@lay:3473l3

# Listing 3: send-cookie.pl

#!/usr/bin/perl -w

# send-cookie.pl.  This program outputs an HTML "meta" tag that
# contains a cookie which expires one week from the program's
# invocation.

use strict;
use diagnostics;
use CGI;

# Make output hot
$| = 1;

# Create an instance of CGI
my $query = new CGI;

# Send a MIME header
print $query->header("text/html");

# Get the current date and time, and add one week to it
my $future_time = time + 604800;

# Turn the time into a valid timestamp
my $in_one_week = scalar localtime($future_time);

# Output a META tag that creates a cookie
print "<META HTTP-EQUIV=\"Set-Cookie\" ";
print "CONTENT=\"RecentVisitor=1;expires=$in_one_week; path=/\">";
