Howdy!
I have done cookies with Perl before which are accomplished like so:
$susername = cookie(-name => 'username',
-value => $userinput,
-expires => '+10m',
);
Then before the page starts pass the follow in the header:
print
header(-cookie => [$susername]);
I used
[] around $susername because I usually have more than one scalar being pushed into a cookie.
The Question:
Can a cookie be created without headers? I have a script that takes in a form, and submits into itself. Does some validation on the perl-side (it also has Javascript validation, but that is irrelevant. Then if the validation is a success the script will past them a cookie and redirect them to another page (page two of the form). Is this possible? Can I "pass the user a cookie" without declaring the cookie in the headers. What are my other options besides having to print a "bogus page" with a redirect message and having a cookie created at that point?
I have been thinking about this all weekend, but that last case scenario is the only possible outcome I can think of, and I don't like it. Monks, please help me!