#!/usr/bin/perl
use warnings;
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
use Apache::Session::File;
my $query = new CGI;
my %session;
my $id = undef;
my $cookie;
my $id = $query->cookie('SID01');
tie %session, 'Apache::Session::File', $id,
{ Directory => "/tmp/",
LockDirectory => "/tmp/"};
unless (defined($id)) {
$cookie = $query->cookie( -name=>'SID01',
-value=>$session{_session_id},
-expires=>'+1y'
);
print $query->header(-cookie=>$cookie);
print "Assigned session ID
";
}
else {
print $query->header();
print "Not assigned session ID
";
};
$id = $session{_session_id};
print "";
print "