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 = new CGI::Session();
10 $s = new CGI::Session("driver:file", $sid);
11 $s = new CGI::Session("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 $CGI::Ses‐
19 sion::Driver::file::FileName global variable. Default value of this
20 variable is cgisess_%s, where %s will be replaced with respective ses‐
21 sion ID. Should you wish to set your own FileName template, do so
22 before requesting for session object:
23
24 $CGI::Session::Driver::file::FileName = "%s.dat";
25 $s = new CGI::Session();
26
27 For backwards compatibility with 3.x, you can also use the variable
28 name $CGI::Session::File::FileName, which will override the one above.
29
30 DRIVER ARGUMENTS
31
32 If you wish to specify a session directory, use the Directory option,
33 which denotes location of the directory where session ids are to be
34 kept. If Directory is not set, defaults to whatever
35 File::Spec->tmpdir() returns. So all the three lines in the SYNOPSIS
36 section of this manual produce the same result on a UNIX machine.
37
38 If specified Directory does not exist, all necessary directory hierar‐
39 chy will be created.
40
41 By default, sessions are created with a umask of 0660. If you wish to
42 change the umask for a session, pass a UMask option with an octal rep‐
43 resentation of the umask you would like for said session.
44
46 If your OS doesn't support flock, you should understand the risks of
47 going without locking the session files. Since sessions tend to be used
48 in environments where race conditions may occur due to concurrent
49 access of files by different processes, locking tends to be seen as a
50 good and very necessary thing. If you still want to use this driver but
51 don't want flock, set $CGI::Session::Driver::file::NoFlock to 1 or pass
52 "NoFlock => 1" and this driver will operate without locks.
53
55 For support and licensing see CGI::Session
56
57
58
59perl v5.8.8 2006-11-24 CGI::Session::Driver::file(3)