I use the GT::CGI in preference to the CGI.pm and have found when I upgraded the GT::CGI from the 1.45 version to 1.93 it broke some code for reading cookies.
I need to know how to deference cookies, its not as the doco says or am
I missing something?
from doco: "or to retrieve a hash of all cookies:
my $cookies = $cgi->cookie; "and the print $cookies->{'thecookie'} ;Basically the code is:
#!/usr/bin/perl -w
use strict ; # This is what flushes out the error
sub main()
{
use GT::CGI;
my $IN = new GT::CGI;
my $cookies = $IN->cookie ; # all cookies in a hash now
print $IN->header() ; # all output to browser now
print "User = $cookies->{UserID}" ;
}
I get the dreaded
"Can't use string ("5") as a HASH ref while "strict refs" in use" which I believe to do with a has ref being treated as a scalar instead of as a variable.
Can someone let me know how I am supposed to dereference the cookie values?
Thanks
doug
------------------------------------------------
Below are the relevent bits from the GT::CGI module's
# ==================================================================
# Gossamer Threads Module Library - http://gossamer-threads.com/
#
# GT::CGI
# Author : Aki Mimoto
# CVS Info : 087,070,085,093,083
# $Id: CGI.pm,v 1.45 2001/02/06 01:40:32 alex Exp $
Code above works fine.
sub cookie {
if (@_ == 0) {
return wantarray ? keys %COOKIES : \%COOKIES;
} etc etc
}
New module causes problem as described.
# GT::CGI
# Author : Aki Mimoto
# CVS Info : 087,071,081,089,087
# $Id: CGI.pm,v 1.93 2001/11/28 03:16:54 jagerman Exp $
sub cookie {
if (@_ == 0) { # Return keys.
return keys %{$self->{cookies}};
} etc etc
}
--------------------------------------------------------
I need to know how to deference cookies, its not as the doco says or am
I missing something?
from doco: "or to retrieve a hash of all cookies:
my $cookies = $cgi->cookie; "and the print $cookies->{'thecookie'} ;Basically the code is:
#!/usr/bin/perl -w
use strict ; # This is what flushes out the error
sub main()
{
use GT::CGI;
my $IN = new GT::CGI;
my $cookies = $IN->cookie ; # all cookies in a hash now
print $IN->header() ; # all output to browser now
print "User = $cookies->{UserID}" ;
}
I get the dreaded
"Can't use string ("5") as a HASH ref while "strict refs" in use" which I believe to do with a has ref being treated as a scalar instead of as a variable.
Can someone let me know how I am supposed to dereference the cookie values?
Thanks

------------------------------------------------
Below are the relevent bits from the GT::CGI module's
# ==================================================================
# Gossamer Threads Module Library - http://gossamer-threads.com/
#
# GT::CGI
# Author : Aki Mimoto
# CVS Info : 087,070,085,093,083
# $Id: CGI.pm,v 1.45 2001/02/06 01:40:32 alex Exp $
Code above works fine.
sub cookie {
if (@_ == 0) {
return wantarray ? keys %COOKIES : \%COOKIES;
} etc etc
}
New module causes problem as described.
# GT::CGI
# Author : Aki Mimoto
# CVS Info : 087,071,081,089,087
# $Id: CGI.pm,v 1.93 2001/11/28 03:16:54 jagerman Exp $
sub cookie {
if (@_ == 0) { # Return keys.
return keys %{$self->{cookies}};
} etc etc
}
--------------------------------------------------------