# Untested my $tempdir = $ENV{TEMP} || $ENV{TMP} || die "No tempdir"; $session = new CGI::Session(undef, $cgi, { Directory => $tempdir });