[Templates] Template with Win32-ASP on Server 2003 ActivePerl

Andersen, John P. AndersJP@ssch.com
Wed, 7 Jun 2006 15:39:10 -0700


I am having a difficult time getting this combp working.  I'm sure I'm
just missing something easy.

My environment (no option to change here, unfortunately)

Windows Server 2003 Standard
IIS 6
ActivePerl 5.8.8 Build 817
Template-Toolkit 2.15

I will be as brief as possible.

If I run the test.pl script from the command line, I get the proper
HTML, so I know Template is working.  I can then open the .html file and
things work just fine.  Here is what it returns:

#=3D=3D=3D   output from "perl test.pl" > test.html  =3D=3D=3D#
<?xml version=3D"1.0" encoding=3D"UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns=3D"http://www.w3.org/1999/xhtml" xml:lang=3D"en" =
lang=3D"en">

<head>
<title>
TT Test</title>
</head>
<body>
 <h1>TT Test</h1>
 <p>This should print "blah": blah</p>
</body>
</html>
#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D#


If I use it in CGI mode, I get this error:
CGI Error
The specified CGI application misbehaved by not returning a complete set
of HTTP headers.

If I use it in ASP mode with Win32::ASP, I get a blank page with no
errors.
I havn't tried ISAPI mode.

Any idea how to make ASP, Template, and Win32::ASP work together?

Here are my files:

(CGI Mode)
#=3D=3D=3D=3D    test.pl =3D=3D=3D=3D=3D#
#!/usr/bin/perl

use strict;
use warnings;
use Template;
$| =3D 1;

my $config =3D {
	INCLUDE_PATH	=3D> 'C:\\Sites\\testnet\\src',
	INTERPOLATE	=3D> 1,
	POST_CHOMP	=3D> 1,
	PRE_PROCESS	=3D> 'header.inc',
	EVAL_PERL	=3D> 1,
};

my $t =3D Template->new($config);

my $vars =3D {
	title	=3D> 'TT Test',
	var1	=3D> 'blah',
};

my $input =3D 'test.tt';

$t->process( $input, $vars ) || die $t->error();
###############################################################

#=3D=3D=3D  header.inc  =3D=3D=3D#
<?xml version=3D"1.0" encoding=3D"UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns=3D"http://www.w3.org/1999/xhtml" xml:lang=3D"en" =
lang=3D"en">

<head>
<title>
[% title %]
</title>
</head>

###############################################################

#=3D=3D=3D   test.tt   =3D=3D=3D#
<body>
 <h1>[% title %]</h1>
 <p>This should print "blah": [% var1 %]</p>
</body>
</html>

##############################################################