Gossamer Forum
Home : General : Perl Programming :

New to perl, need hlp . Please

Quote Reply
New to perl, need hlp . Please
Hi I am new to perl and I need your help. I can't figure out how to read cookies. It's probably very simple.

I have existing simple cookie with name User and value Mark.

I have script:
Code:
#!/usr/bin/perl
use CGI;
my $query = new CGI;
my $cookie_in = $query->cookie('User');
print "Content-type: text/html\n\n";
print "Value is $cookie_in";
exit;

If I execute script as part of *.shtml page

Code:
<!--#exec cgi="/cgi-bin/SSI-LastName.cgi"-->
I will get cookie value as I need. No problem there,

If I run the same script it self it will display blank page. It will not find the cookie. What do I have to do if I want to read cookie "User" in perl script and use value somwhere else in the script.

Why script can not read cookies unless I execute it in shtml file?

I really need help because I am new to cookies and I know just a little bit about perl.

Thank you Charles
Quote Reply
Re: [Charles_cz] New to perl, need hlp . Please In reply to
I'd recommend looking into -path when setting the cookie. You probably need to define the cookie to be allowed to be read from any part of your site (I had a similar problem not so long ago).

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates