I don't quite understand these questions but I have two comments that
might be relevant. Please don't treat these as authoritative, though.
(1) did you define
$sessionID somewhere else? If not, the script as will fail under
strict, as well as your cookie being deficient.
(2) for some reason I don't understand,
$badcookie seems to be a hash reference rather than a scalar.
Taking these together I get your script to run amended thus:
use strict;
use CGI qw(:all);
use CGI::Cookie;
# insert definition of $sessionID:
my $sessionID = "hello world";
my ($domain, $name, $value, $expires) = ('65.1.136.248', 'SessionID',
+$sessionID, '+1Y');
my $cookieheader = new CGI::Cookie(-name => $name,
-value => $value,
-expires => $expires) || die;
# left out domain so it wd work on my web space
print header(-cookie=>$cookieheader);
my $badcookie = fetch CGI::Cookie('SessionID');
# print $badcookie as hashref, not scalar:
print $badcookie->{'SessionID'};
§
George Sherston
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.