[rochester-pm-list] I held out!!

Fred Edmister fedm at pkcommunications.com
Tue Jan 4 12:38:33 CST 2000


	This time I've done everything I can... Read, debugged... This is the 
problem.. I have the cookie script that writes a cookie, and then redirects 
to another URL... Here's the problem... It writes the cookie, then puts the 
code for redirecting in the page view... If it redirects first, it doesn't 
write the cookie... (so it does everything it's supposed to do, just not 
all together.. )  Below is the code... (and yes, that's all of it, all it's 
supposed to do is write the cookie and dump them back to the main page... 
)   Thanks in advance to any suggestions..   Also, I've tried placing the 
calls for each sub all over... I'm still having no luck!    :)

	Fred


{clip}
#!/usr/bin/perl

## Call Location from within the place cookie sub
	&place_cookie();
	&relocate();	

sub relocate {

         $url = "http://www.website.com/index.html\n\n";
         print "Location: $url\n\n";
}




sub place_cookie {



# Place cookie code-stuff in here./...


         use CGI qw/:standard/;
         use CGI::Cookie;

	$store_id = param (storeid);

         # Create new cookies and send them
         $cookie1 = new CGI::Cookie(-name=>'STOREID',-value=>$id, 
-domain=>'.domain.com' -path=>'www.domain.com/');


         print header(-cookie=>[$cookie1]);
         # fetch existing cookies
         %cookies = fetch CGI::Cookie;
         $id = $cookies{'STOREID'};

         # create cookies returned from an external source
         %cookies = parse CGI::Cookie($ENV{COOKIE});



## At end of place_cookie call the relocate sub and we should be clear of
##the header we used....

}

{end clip}




More information about the Rochester-pm mailing list