QuoteIf you wish to specify a session directory, use the Directory option, which denotes location of the directory where session ids are to be kept. If Directory is not set, defaults to whatever File::Spec->tmpdir() returns.
$self->{Directory} ||= File::Spec->tmpdir();
1 2 3 4 5 6 7 8 9
sub tmpdir { return $tmpdir if defined $tmpdir; $tmpdir = $_[0]->_tmpdir( map( $ENV{$_}, qw(TMPDIR TEMP TMP) ), 'SYS:/temp', 'C:\system\temp', 'C:/temp', '/tmp', '/' ); }
1 2 3 4 5 6 7 8 9 10 11 12 13
my $tempdir = $ENV{TMP} || $ENV{TEMP} ||"$ENV{DOCUMENT_ROOT}/cgi-bin/tmp"; # Session einlesen (benutzt per Default bei undef driver:file) my $session = CGI::Session->load(undef, undef, {DIRECTORY => $tempdir}) or die CGI::Session::errstr; if ($session->is_expired) { } elsif ($session->is_empty) { } else { #oder neue Session erzeugen $session = session->new(); }