1CGI::Session::Driver::fUisleer(3C)ontributed Perl DocumeCnGtIa:t:iSoenssion::Driver::file(3)
2
3
4
6 CGI::Session::Driver::file - Default CGI::Session driver
7
9 $s = CGI::Session->new();
10 $s = CGI::Session->new("driver:file", $sid);
11 $s = CGI::Session->new("driver:file", $sid, {Directory=>'/tmp'});
12
14 When CGI::Session object is created without explicitly setting driver,
15 file will be assumed. file - driver will store session data in plain
16 files, where each session will be stored in a separate file.
17
18 Naming conventions of session files are defined by
19 $CGI::Session::Driver::file::FileName global variable. Default value
20 of this variable is cgisess_%s, where %s will be replaced with
21 respective session ID. Should you wish to set your own FileName
22 template, do so before requesting for session object:
23
24 use CGI::Session::Driver::file; # This line is mandatory.
25 # Time passes...
26 $CGI::Session::Driver::file::FileName = "%s.dat";
27 $s = CGI::Session->new();
28
29 For backwards compatibility with 3.x, you can also use the variable
30 name $CGI::Session::File::FileName, which will override the one above.
31
32 DRIVER ARGUMENTS
33 If you wish to specify a session directory, use the Directory option,
34 which denotes location of the directory where session ids are to be
35 kept. If Directory is not set, defaults to whatever
36 File::Spec->tmpdir() returns. So all the three lines in the SYNOPSIS
37 section of this manual produce the same result on a UNIX machine.
38
39 If specified Directory does not exist, all necessary directory
40 hierarchy will be created.
41
42 By default, sessions are created with a umask of 0660. If you wish to
43 change the umask for a session, pass a UMask option with an octal
44 representation of the umask you would like for said session.
45
47 If your OS doesn't support flock, you should understand the risks of
48 going without locking the session files. Since sessions tend to be used
49 in environments where race conditions may occur due to concurrent
50 access of files by different processes, locking tends to be seen as a
51 good and very necessary thing. If you still want to use this driver but
52 don't want flock, set $CGI::Session::Driver::file::NoFlock to 1 or pass
53 "NoFlock => 1" and this driver will operate without locks.
54
56 For support and licensing see CGI::Session
57
58
59
60perl v5.32.0 2020-07-28 CGI::Session::Driver::file(3)