Page is a not externally linkable
- Code, Content, and Presentation
-- Perl Server Side CGI Scripting
Brett_Tabke - 4:05 pm on Dec 8, 2011 (gmt 0)JS is a browserside language. It runs in the browser only.
Lets make sure we are on the same page.
Perl is a server side lanaugage and runs only on the server.
JS can set and read cookies.
The only time those cookies are sent to the server is via a request as part of the HTTP header. Most often, that request is going to be a result of a pageview or downloading a graphic.
Somehow we have to get that cookie back to the perl program to work on. Most times, that is going to be directly calling that Perl program. Then the perl program can look at the server headers where the cookie data resides, and then do something with it.
So, the challenge is getting it into Perl - 3 options to pass the data to Perl via a HTTP header:
a page view. You directly call the perl script.
AJAX. quietly call your perl script from AJAX formated code to send the cookie.
a transparent image graphic pull that actually calls the perl script.
How you go about each of those is a bit different.
I would say you first homework, is to study perl enough to figure out how to get the cookie from the http headers. Then move on to figuring out how you are going to get the cookie from the browser.
Thread source:: http://www.webmasterworld.com/perl/4395572.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com