Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^6: creating and Deleting a new cookie

by tsdesai (Acolyte)
on Jun 27, 2017 at 08:18 UTC ( [id://1193666]=note: print w/replies, xml ) Need Help??


in reply to Re^5: creating and Deleting a new cookie
in thread creating and Deleting a new cookie

Hi Huck, Thank you for your input. The line !/usr/bin/perl always there in my code except that i accidentally didn't put on the forum. I have just managed to work with one additional change and its started to work. As i have multiple print statement in the code as in I am setting the cookie and then redirect the user to the url. It either redirects or writes the cookie. though, i have found work around to it , I am not sure whether that is the right way to do it. My code after the cookies started working.
use strict; use CGI; my $q = new CGI; my $returnurl; my $pass=$q->cookie('pass'); my $JsessCookie = $q->cookie(-name=>$pass, -value=>'', -path=>'/', -ex +pires=>'-1h'); my $tempcookie = $q->cookie(-name=>'tempc', -value=>'', -path=>'/'); my $url="https://test.com/return=$returnurl"; #tried the below but doesn't redirect <b>shows 302 status</b> #print $q->redirect(-cookie=>[$JsessCookie,$tempcookie],-uri=>$url); #<b>this is the working redirection code- but not sure whether its the + right way forward</b> print $q->header(-cookie=>[$JsessCookie,$tempcookie]); print qq~<meta http-equiv="refresh" content="0;URL=$url">\n;
Many Thanks for all your help so far

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-25 07:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found