Ok,
Baz
I did some reviewing on how to do this in CGI, since I haven't done anything with CGI for a while, and came up with *possibly* a solution to your problem. Note: I am not sure if it is exactly what you want it to do, but at least it finds the cookie, and prints its value :).
#!/usr/local/bin/perl -w
use strict;
use CGI;
my $query = new CGI;
my $cookie_out = $query->cookie(
-name=>"MY_NAME",
-value=>"Barry Griffin",
-expires=>'+24h',
-path=>'/cgi-bin/',
-domain=>'bladx.perlmonk.org',
-secure=>0
);
print $query->header(-cookie=>$cookie_out);
print $query->start_html("Cookie Test");
# DEBUG TO SCREEN
my $rcvd_cookies = $ENV{'HTTP_COOKIE'};
my @cookies = split /;/, $rcvd_cookies;
foreach my $cookie (@cookies)
{
print $cookie,"\n";
}
print $query->end_html;
Hopefully this helps with your cookies fun. And a little note, I know that you are still somewhat new to asking question at pm.org, and just to let you know, you may want to make shorter, more descriptive titles :) ... just a thought, keep on the Perl path though!
Also, if you would like to see where I tested this script, I did it at:
here. I don't think Tripod is the best server, I still suggest talking to
jcwren about getting a free testing account at perlmonk.org!
Andy Summers
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.