Analog
Analog

Reputation: 261

jquery function showing 500 in perl print

I'm not exactly sure what is going on here so I'm having a hard time trying to debug this problem. Here is a very simply example of my perl script that is just printing some html:

#!/usr/bin/perl -w
use strict;
use warnings;

use HTML::Template;

my $template_object = qq|<html>
<head>
    <title>Test</title>
    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
    $(function() {  
        alert("here");
    }); 
   </script>
</body>
</html>|;   
my $template = HTML::Template->new(scalarref => \$template_object);

print "Content-type: text/html\n\n";
print $template->output();

The problem is when I run this, I don't get the JS alert and if I look at the source, the $(function has 500 500 in it - this is what the source looks like after in both IE and FF:

<html>
<head>
    <title>Test</title>
    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
    500 500function() { 
        alert("here");
    }); 
   </script>
</body>
</html>

Its not a HTML::Template thing (I tried it without and got the same results), any idea why I'm seeing those 500's?

TIA

Upvotes: 0

Views: 108

Answers (1)

Barmar
Barmar

Reputation: 781105

You need to use the quoting operator that doesn't interpolate:

my $template_object = q|<html>

500 500 was coming from the interpolation of $(, which is the short name of $GID, the list of groups you belong to.

Upvotes: 3

Related Questions