Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

session handling with cgi

by rjsaulakh (Beadle)
on May 27, 2005 at 13:06 UTC ( [id://461049]=perlquestion: print w/replies, xml ) Need Help??

rjsaulakh has asked for the wisdom of the Perl Monks concerning the following question:

Following is the piece of code i have tried to write please let me know you comments. also i am not getting any display for the same where am i making an error
nor any logs are getting generated for me

#!c:\Perl\bin\perl.exe #PLEASE ENTER THE PATH WHERE YOUR CGI PROGRAM WILL BE STORED -wT use strict; use CGI; use CGI::Cookie; use Data::Dumper; #use CGI::Session::File; my $cgi = new CGI; print $cgi->header; print $cgi->start_html; #print <<HERE; #<b>jkasgdf</b> use constant SESSION_COOKIE => "MY_SITE_SIDE"; my $sid = $cgi->param("sid") || undef; #creating a new session my $session = new CGI::Session::File(undef, {LockDirectory =>"/Amexpmo/login/a +mex/sessionlogs", Directory =>"/Amexpmo/login/amex/ +sessionlogs"}) or die $CGI::Session::errstr; print "Your session id is ", $session->id(); # A cookie is being created which is then being send to the user brows +er my $cookie = $cgi->cookie(CGISESSID => $session->id ); print $cgi->header(-cookie=>$cookie); # $session->save_param($cgi, ["login_name", "password"]); # this line saves all the available/accessible CGI params $session->save_param($cgi); print Dumper(\$session); $session->expire('+3h'); print Dumper; #HERE #print $cgi->end_html;

Replies are listed 'Best First'.
Re: session handling with cgi
by Joost (Canon) on May 27, 2005 at 13:14 UTC
Re: session handling with cgi
by ghenry (Vicar) on May 27, 2005 at 13:11 UTC

    Hi, I would add:

    • use CGI::Carp('fatalsToBrowser');
    • use warnings;

    And then see what that gives you.

    HTH.

    Walking the road to enlightenment... I found a penguin and a camel on the way.....
    Fancy a yourname@perl.me.uk? Just ask!!!

      ...but (to the OP) realize that fatalsToBrowser should be used only during development/debugging, and not in production code; see here for why.

      the lowliest monk

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://461049]
Approved by ghenry
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-03-29 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found