Page is a not externally linkable
nelmo - 3:37 pm on Dec 8, 2011 (gmt 0)
Ok, newbie (to forum and PERL), so be kind...
I've got an app written in Perl that I want to use a cookie in. I've got lots of examples of cookie functions in JS but I'm confused about how to get data back from the JS function to the PERL script.
So I have this:
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
In my Perl script, do I just need to have:
print <<TheEnd
<script ....
rtn=readCookie("Fred");
TheEnd
print "Cookie is: $rtn";
Apologies for syntax etc, just want to get basic idea - will 'rtn' be visible to my Perl script?