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