in reply to Re^7: auto create cookies
in thread auto create cookies

like this similar example but not working. it checks for cookies with value and modify it automatically. every time when u execute the script. it modify the cookie with new specified value

#!/usr/bin/perl use CGI::Cookie; my %cookies = fetch CGI::Cookie; my $new_value = 'modify'; print "Content-type: text/html\n\n"; foreach (keys %cookies) { #change value of NewCookie if($_ eq 'NewCookie') { my $val_cookie = $cookies{'NewCookie'}->value; print "\n value of NewCookie =>" . $val_cookie; $cookies{'NewCookie'}->value($new_value); $cookies{'NewCookie'}->bake; } }

Replies are listed 'Best First'.
Re^9: auto create cookies
by Your Mother (Archbishop) on Jan 27, 2019 at 20:30 UTC

    You can't send/set a cookie after the headers. You should really investigate Mojolicious, Dancer2, Catalyst (worst choice for CGI deployment), et cetera. They all handle huge amounts of this stuff automatically. And take some time to read the links and tutorials that other monks have suggested. If you just hammer away at a problem until an answer gives, you're not learning anything, the problems will persist, and you'll slowly alienate anyone who was willing to help when they see they're just helping with the same class of question over and over.

    A reply falls below the community's threshold of quality. You may see it by logging in.