Update: Here is the entire code:
#!/usr/bin/env perl use strict; use warnings; #BEGIN { # $| = 1; # open (STDERR, ">&STDOUT"); # print qq~Content-type: text/html\n\n~; #} use CGI; use CGI::Cookie; use CGI::Carp qw(fatalsToBrowser); use DBI; use DBD::Pg; use LWP 5.69; use HTTP::Request::Common qw( POST ); use HTML::Entities; my $buffer = ""; my $name = ""; my $value = ""; my @pair; my $key; my $cookie; my $test; my $session; my $query; #$main::cookies = $main::session->cookie(-name => 'NCWiFiTest', # Set username $main::session = new CGI; $main::cookie = $main::session->cookie(-name => 'User-Name', -value => 'todd', -domain => 'localhost', -path => '/', -expires => '+1d' ); $main::cookie->bake; print "<hr>\n"; $main::query = new CGI; $main::test = ""; $main::test = $main::query->cookie(-name => 'User-Name'); print "User Name --> $main::test\n"; print "<br>"; print "<hr>\n"; foreach $main::key (keys %ENV) { print "$main::key --> $ENV{$main::key}<br>"; } print "End of environment<P>"; # Get the input read(STDIN, $main::buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @main::pairs = split(/&/, $main::buffer); foreach $main::pair (@main::pairs) { ($main::name, $main::value) = split(/=/, $main::pair); # Un-Webify plus signs and %-encoding $main::value =~ tr/+/ /; $main::value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # Stop people from using subshells to execute commands # Not a big deal when using sendmail, but very important # when using UCB mail (aka mailx). $main::value =~ s/~!/ ~!/g; # Uncomment for debugging purposes print "Setting $main::name to $main::value<P>"; } exit;
The call returns (in opera) with the following values set:
HTTP_COOKIE --> User-Name=todd
HTTP_COOKIE2 --> $Version=1

Live HTTP Headers (in Firefox) shows:
Set-Cookie: User-Name=todd; domain=localhost; path=/; expires=Wed, 08-Aug-2007 02:49:15 GMT Update: I tried using CGI::Simple::Cookie. This works, the only change noted is that the header includes "Cookie: " instead of "Set-Cookie: ". I will investigate this further.


In reply to Re: CGI::Cookie problem in FF and IE by proceng
in thread CGI::Cookie problem in FF and IE by proceng

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.