Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

storing data in session variable

Status
Not open for further replies.

rakeshou

Programmer
Aug 15, 2006
17
US
I want to store the username and login_id in the session .

i am tryin to do this.

Code:
$session = $q->cookie(-name=>$session->name,-value=>$session->id); #session cookie
                 $session{"username"}   =        $q->param("$usernameVar");
                 $session{"login_id"}   =        $q->param("$login_id");
                 $cookie13 = $q->cookie(-name=>'login_id',-value=>$login_id); #cookie 1
                 print $q->header(-location=>'show_profile.pl',-cookie=>[$cookie13,$session]);
Software error:
Global symbol "%session" requires explicit package name at /var/ line 145.
Global symbol "%session" requires explicit package name at /var/ line 146.
Execution of /var/ aborted due to compilation errors.

I have defined the session variable as:

Code:
my $session;

if i just write

Code:
$session = $q->cookie(-name=>$session->name,-value=>$session->id); #session cookie
$cookie13 = $q->cookie(-name=>'login_id',-value=>$login_id); #cookie 1
print $q->header(-location=>'show_profile.pl',-cookie=>[$cookie13,$session]);

it works fine by just sending session cookie to the HTTP header.

Please help.

Rakesh
 
my %session;


Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top