Bradley,

When I use:

 print "<br>$_ - " . $cookie{$_}->value . "<br>";

I get "Can't call method "value" on an undefined value"!

Any ideas?

Thanks,

Jerry

"Bradley M. Handy" wrote:
> 
> > -----Original Message-----
> > From: Jerry Preston [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, July 11, 2001 7:29 AM
> > To: cgi
> > Subject: cookies
> >
> >
> > Hi!
> >
> > I guess I am missing the boat.  I have read CGI::Cookie and
> > played with the code, but I would think that I should be able to
> > read the netscape cookies
> > file in by NT system.  My script is running on a unix server.  Is
> > this possible.  I have tried to set a cookie and the read it,  no luck.
> >
> > print "env $ENV{'HTTP_COOKIE'} <br>";
> >
> >
> >  $c = new CGI::Cookie( -name    =>  'Testing',
> >                        -value   =>  [ "jwp", '[EMAIL PROTECTED]' ],
> >                        -expires =>  '+3M',
> >                        -domain  =>  'xxxx.xxx',
> >                        -path    =>  '/'
> >                        -secure  =>  0
> >                       );
> >
> >   print "Set-Cookie: $c\n<br>";
> >   print $query->header(-cookie=>$c);
> >   print "Set-Cookie: ",$c->as_string,"\n<br>";
> >
> > #Recovering Previous Cookies
> >
> >  @defaults=$query->cookie('dm5apps.de.sc.ti.com');#'www.kitchenetc.com');
> 
> The above line should be:
> @defaults = $query->cookie('Testing');  # always fetch a cookie with the
> name you gave it.
> 
> >
> > print "<br>defaults *@defaults*<br>";
> >
> >  %cookies = fetch CGI::Cookie;
> >  foreach (keys %cookies) {
> >    print "<br>$_ - ($cookies{$_})<br>";
> 
> The above line should be:
> print "<br>$_ - " . $cookie{$_}->value . "<br>";
> 
> fetch CGI::Cookie returns a hash of CGI::Cookie objects with the key as the
> name of the cookie.
> 
> >  }
> >
> > Thanks for YOUR help,
> >
> > Jerry
> >

Reply via email to