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
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.