I will try flushing after sessin destroy.By that time following is my code.
1. From php files I am receiving parameter to my perl file through GET.
2. In Perl File – It is multiple form almost 4 four pages
On every page submit session_start functions check for whether session exists or not .If, yes then it reinitialize else create new. So, on page 1 it creates new session id and till I submit my page session Id is saved as hidden field in form and it propagate from one page to last page and I keep on initialing it. It a huge code I cann’t paste here these are the lines in my code to start and destroy the session.
my $q=new CGI;
my %KVP=$q->Vars;
$id=KVP{'sessionid'}) //post hidden variable
$session=&session_start($q,$id);
$sessionid=$session->id;
.
.
.
if($session)
{
session_destroy($session);
//This doesn’t empty the cgisess_ var in /tmp
}
sub session_start()
{
my($cgi,$session_id)=@_;
if($session_id eq '')
{
#create new session
$session = new CGI::Session(undef, $cgi, {Directory=>'/tmp/'});
}
else
{
#reinitialse with session with session id
$session= new CGI::Session(undef, $session_id, {Directory=>'/tmp'}
+)
}
return $session;
}
sub session_destroy()
{
my($session)=@_;
$session->delete();
}
This is what i understand from myself and tried to implement it on my project. If you find something is not good practice or this thing can be done in more efficient way . Kindly advice me on it also.
Thanks .
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.