Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

CGI redirect

by yschang (Initiate)
on Feb 03, 2000 at 19:28 UTC ( [id://2798]=perlquestion: print w/replies, xml ) Need Help??

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

I am using CGI package. according to the document of CGI model, when I use redirect function I can use all the attributes offered in header function such as cookie etc. But I found out a lot of attributes I can set in header but they don't work when I use redirect. Why? Thnaks you sheng

Replies are listed 'Best First'.
Re: CGI redirect
by mortis (Pilgrim) on Feb 04, 2000 at 02:14 UTC
    You should be able to, are you trying something like this?:
    my $cookie = $query->cookie(-name=>'foo',-value=>'bar',-domain=>'mydom +ain.com'); print $query->header(-type=>'text/html',-cookie=>$cookie);
    To generate cookies, you have to use the CGI::cookie method.
Re: CGI redirect
by mortis (Pilgrim) on Feb 04, 2000 at 02:22 UTC
    You should be able to, are you trying something like this?:
    my $cookie = $query->cookie(-name=>'foo',-value=>'bar',-domain=>'mydom +ain.com'); print $query->header(-type=>'text/html',-cookie=>$cookie);
    To generate cookies, you have to use the CGI::cookie method.
      Maybe I didn't state my question clearly. I mean I can't do this when I use $query->header function. However I can't do this when I use $query->redirect function. But from docuementation of CGI model, It seems to me that I can send cookie when I use redirect function. But in reality I can't. As matter of fact I have done the way you mentioned. What I try to do is to use $query->redirect function to send the cookie to the client.
Re: CGI redirect
by yschang (Initiate) on Feb 04, 2000 at 02:34 UTC
    Maybe I didn't state my question clearly. I mean I can't do this when I use $query->header function. However I can't do this when I use $query->redirect function. But from docuementation of CGI model, It seems to me that I can send cookie when I use redirect function. But in reality I can't. As matter of fact I have done the way you mentioned. What I try to do is to use $query->redirect function to send the cookie to the client. you sheng

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2025-05-20 06:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.