http://qs321.pair.com?node_id=573216

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

Hi Monks!

All that I am trying to do here is to set these cookies (the cookies part work if) and redirect to another page after the cookies get set, but if I use any of the methods here the cookies will not work. Why?
Can someone give me a hand on that please?
I tried all of them.
Here is the code:

#!/usr/bin/perl use CGI qw/:standard/; use CGI::Carp qw(fatalsToBrowser); use strict; use DBI; use CGI qw(:all); my $query = new CGI; my $name="Joe X"; my $buddy = "more Numbers XY"; my $cookie1 = $query->cookie(-name=>'name', -value=>"$name", -expires=>'+4h', -path=>'/'); my $cookie2 = $query->cookie(-name=>'buddy', -value=>"$buddy", -expires=>'+4h', -path=>'/'); print $query->header(-cookie=>[$cookie1,$cookie2]); my $got_cookie1 = $query->cookie('name'); my $got_cookie2 = $query->cookie('buddy'); if($f_name eq ""){$name = $got_cookie1;} if($buddy eq ""){$buddy = $got_cookie2;} print "<meta http-equiv=\"refresh\" content=\"2\";\ url=http://www.myp +age.com/cgi-bin/per.pl?buddy=$buddy&name=$name\">"; print $query->redirect('http://www.mypage.com/cgi-bin/per.pl?buddy=$bu +ddy&name=$name'); my $url = "http://www.mypage.com/cgi-bin/per.pl?buddy=$buddy&name=$nam +e"; print "Location: $url\n\n"; print $query->end_html;

Thanks a lot!!!!