data/TWiki/CGISessionDriverFileDotPm.txt
changeset 0 414e01d06fd5
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/data/TWiki/CGISessionDriverFileDotPm.txt	Sat Jan 26 15:50:53 2008 +0100
     1.3 @@ -0,0 +1,53 @@
     1.4 +---+ Package ==
     1.5 +
     1.6 +%TOC%
     1.7 +=head1 NAME
     1.8 +
     1.9 +CGI::Session::Driver::file - Default CGI::Session driver
    1.10 +
    1.11 +=head1 SYNOPSIS
    1.12 +
    1.13 +    $s = new CGI::Session();
    1.14 +    $s = new CGI::Session("driver:file", $sid);
    1.15 +    $s = new CGI::Session("driver:file", $sid, {Directory=>'/tmp'});
    1.16 +
    1.17 +
    1.18 +=head1 DESCRIPTION
    1.19 +
    1.20 +When CGI::Session object is created without explicitly setting I<driver>, I<file> will be assumed.
    1.21 +I<file> - driver will store session data in plain files, where each session will be stored in a separate
    1.22 +file.
    1.23 +
    1.24 +Naming conventions of session files are defined by C<$CGI::Session::Driver::file::FileName> global variable. 
    1.25 +Default value of this variable is I<cgisess_%s>, where %s will be replaced with respective session ID. Should
    1.26 +you wish to set your own FileName template, do so before requesting for session object:
    1.27 +
    1.28 +    $CGI::Session::Driver::file::FileName = "%s.dat";
    1.29 +    $s = new CGI::Session();
    1.30 +
    1.31 +For backwards compatibility with 3.x, you can also use the variable name
    1.32 +C<$CGI::Session::File::FileName>, which will override the one above. 
    1.33 +
    1.34 +=head2 DRIVER ARGUMENTS
    1.35 +
    1.36 +If you wish to specify a session directory, use the B<Directory> option, which denotes location of the directory 
    1.37 +where session ids are to be kept. If B<Directory> is not set, defaults to whatever File::Spec->tmpdir() returns. 
    1.38 +So all the three lines in the SYNOPSIS section of this manual produce the same result on a UNIX machine.
    1.39 +
    1.40 +If specified B<Directory> does not exist, all necessary directory hierarchy will be created.
    1.41 +
    1.42 +By default, sessions are created with a umask of 0660. If you wish to change the umask for a session, pass
    1.43 +a B<UMask> option with an octal representation of the umask you would like for said session. 
    1.44 +
    1.45 +=head1 NOTES
    1.46 +
    1.47 +If your OS doesn't support flock, you should understand the risks of going without locking the session files. Since
    1.48 +sessions tend to be used in environments where race conditions may occur due to concurrent access of files by 
    1.49 +different processes, locking tends to be seen as a good and very necessary thing. If you still want to use this 
    1.50 +driver but don't want flock, set C<$CGI::Session::Driver::file::NoFlock> to 1 or pass C<< NoFlock => 1 >> and this 
    1.51 +driver will operate without locks.
    1.52 +
    1.53 +=head1 LICENSING
    1.54 +
    1.55 +For support and licensing see L<CGI::Session|CGI::Session>
    1.56 +