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 . 'formspace.tt'; 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 . 'index.tt'); $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, demo.pl, 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?


In reply to jQuery cookie function not working with HTML::Template by jonnyfolk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.