Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

jQuery cookie function not working with HTML::Template

by jonnyfolk (Vicar)
on Sep 07, 2015 at 08:44 UTC ( #1141236=perlquestion: print w/replies, xml ) Need Help??

jonnyfolk has asked for the wisdom of the Perl Monks concerning the following question:

I'm writing a basic Bootstrap HTML page, and decided to install a jQuery cookies script to comply with the stupid EU regulations.

#!/usr/bin/perl use strict; use CGI::Carp qw(fatalsToBrowser); use CGI ':standard'; use HTML::Template; print "Content-type:text/html\n\n"; my $path = '/path/'; my $formspace = $path . ''; my $file_contents; open FH, '<', $formspace or die "Can't open $formspace: $!"; $file_contents = do { local $/; <FH> }; close FH; my $template = HTML::Template->new(filename => $path . ''); $template->param(FORMSPACE => $file_contents); print $template->output;

The script picks up the data and templates and prints as I want - no problems.

The problem is that when I include the jQuery cookie script, it doesn't work. That might seem to be a problem with the way I've applied the script. However if I generate the HTML with my script,, copy the html generated and paste it into a page demo.html, then the cookie script functions as normal.

Has anybody come across this behaviour before?

Replies are listed 'Best First'.
Re: jQuery cookie function not working with HTML::Template
by Corion (Pope) on Sep 07, 2015 at 08:49 UTC

    How does your generated HTML differ from the working HTML?

    Maybe your browser shows a Javascript in the error console?

    Are you sure that your use of cookies actually falls under the EU regulation? The EU regulation only applies to cookies used for tracking and/or advertising. Simple login cookies are exempt for example.

      Thanks for your observations. I hadn't realised that the regulation was limited, so I don't think it would apply to me.

      Also looking at the errors showed me that there was a difference between generated and working - my ftp client was not updating the page as requested! Good advice, with thanks.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1141236]
Approved by Old_Gray_Bear
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2021-09-19 10:53 GMT
Find Nodes?
    Voting Booth?

    No recent polls found