jerrygarciuh has asked for the wisdom of the Perl Monks concerning the following question:

Hello all,
The code below is an attempt to simplify and debug a more complicated cookie checker. However no cookie is being set. My browser is set to accept cookies and I have many in my Temp Int. file. I am refreshing the file list to check for the cookie to no avail. I do not have CGI::Cookie on the server and would rather not do a local install especially as CGI.pm should be able to handle this no problem. Please advise me as to what my error is.
TIA,
jg
#!/usr/bin/perl -w use strict; use CGI; use CGI qw/:standard/; use CGI::Carp qw/fatalsToBrowser /; my $q = CGI->new(); my $name = "AnolaFlashcookie"; cookie_check(); sub cookie_check { my $cookie = $q->cookie(-name=>"$name", -value=>"$name", -expires=>'+12h', -path=>'/home/thesite/www/cgi-bin/', -domain=>'thesite.com', -secure=>1); print $q->header(-cookie=>$cookie); my $cookie_set = $q->cookie(-name=>"$name"); if (defined $cookie_set) { print $q->header( "text/html" ), h1("Cookie was set!"); } else { print $q->header( "text/html" ), h1("Cookie was NOT set!"); } }
_____________________________________________________
It's not my tree.

Replies are listed 'Best First'.
(cLive ;-) Re: Cookie Not Set
by cLive ;-) (Prior) on Feb 19, 2002 at 22:11 UTC
    This comes up so many times, I wrote a special Q&A for it here.

    cLive ;-)

    --
    seek(JOB,$$LA,0);

Re: Cookie Not Set
by Anonymous Monk on Feb 20, 2002 at 03:32 UTC
    oh jerrygarciuh, I thought you understood how CGI works .... please read a tutorial on CGI, and then the pod for CGI.pm
      I will freely admit to being a slow learner, but most people who are staying home with a 2 year-old while finishing their Masters in Education, honing their lost-wax bronze casting skills, and learning Perl for fun tend to have a dull edge somewhere.

      However, I must insist that I have RTFM, pod and all, and am working my way through the Mouse book now. And all I am asking is for someone to point out where I have erred so I can learn from the mistake.
      TIA,
      jg
      _____________________________________________________
      It's not my tree.