CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Cookies

 



Fred-PK
Deleted

Dec 29, 1999, 8:55 AM

Post #1 of 4 (3238 views)
Cookies Can't Post

   I was wondering if anyone could help me... I'm trying to write a cookie that doesn't return anything back to an HTML... What I need is a cookie set, then to be called later for the variable that it holds. I've looked around, and everything I've found refering to cookies always returns an html file. If anyone knows what I might be able to do as a work around, it would be great! Thank you in advance for any help you may be able to provide!


Fred


Borderline
Deleted

Dec 29, 1999, 4:52 PM

Post #2 of 4 (3238 views)
Re: Cookies [In reply to] Can't Post

Fred,

Not sure I get what you are saying. You want to set a cookie but not display any html to the user? What do you want to display?
There are two ways that I know of to send a cookie to a browser.
1) Send it in the http header. You could either find out the format for the cookie from the appropriate RFC or you can use a module that writes the cookie for you. Such modules include CGI and CGI::Cookie.
The home page for CGI is http://stein.cshl.org/WWW/software/CGI/cgi_docs.html . Not sure what it is for CGI::Cookie but if you type
perldoc CGI::Cookie
It should bring up the man page for it on just about any unix type system.
If you don't want to use the module I could look up the RFC and post it here.

2) You can set it with JavaScript. I know some JavaScript basics but I have never used it to set a cookie. You can look that method up here http://developer.netscape.com/docs/manuals/js/client/jsref/index.htm and here http://developer.netscape.com/docs/manuals/js/client/jsguide/index.htm

Well I am not sure if any of this helped you in your cause but I sure hope so.

Scott Beck


Jasmine
Administrator / Moderator

Dec 29, 1999, 5:13 PM

Post #3 of 4 (3238 views)
Re: Cookies [In reply to] Can't Post

Fred-PK:

Assuming you want to set a CGI (not JavaScript) cookie, it sounds like the easiest way for you to go is to grab a cookie library, or use the CGI module (use CGI qw/:standard :netscape/ Wink.

Two (free) cookie libraries are Cookie-lib.pl andHTTP Cookie Lib. Both of these libraries offer detailed information on how to set and delete cookies via your Perl CGI program.

After you install your cookie library and incorporate the cookie-setting functions into your Perl program(s), the information in any of the cookies that you set will be available to all Perl programs you have on your server.

For example, our sister company, YourDomainHost, offers a free month of domain hosting to any of their clients who refer a new client to them. To keep track of who referred who, special links that look like http://yourdomainhost.com/cgi-bin/welcome.pl?perlarchive are used. The welcome.pl program's sole responsibility is to dish out cookies.

So whenever someone clicks on the special link and signs up, the ordering application looks for a cookie, and if there is one,
credits the client who referred them.

Is this the type of cookie usage you're looking for?

Also, if you'd like to try the CGI module, an excellent tutorial is at webreview.com. The tutorial offers line-by-line instructions on how to set cookies using the CGI module.

-Jasmine


Fred-PK
Deleted

Dec 30, 1999, 6:16 AM

Post #4 of 4 (3238 views)
Re: Cookies [In reply to] Can't Post

  Thank you both for your assistance... Smile It helped me tremendously!! I hope I can be of some assistance in the future... Smile

Fred E

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives