List Info

Thread: Template with Win32-ASP on Server 2003 ActivePerl




Template with Win32-ASP on Server 2003 ActivePerl
user name
2006-06-07 22:39:10
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:

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

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

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


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)
#====    test.pl =====#
#!/usr/bin/perl

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

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

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

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

my $input = 'test.tt';

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

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

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

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

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

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

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



_______________________________________________
templates mailing list
templatestemplate-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/t
emplates
Template with Win32-ASP on Server 2003 ActivePerl
user name
2006-06-08 01:26:54
Andersen, John P. wrote:
> 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:
> 
> #===   output from "perl test.pl" >
test.html  ===#
> <?xml version="1.0"
encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN"
> "htt
p://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
;
> 
> <html xmlns="http://www.w3.org/1999/x
html" xml:lang="en"
lang="en">
> 
> <head>
> <title>
> TT Test</title>
> </head>
> <body>
>  <h1>TT Test</h1>
>  <p>This should print "blah":
blah</p>
> </body>
> </html>
>
#===========================================================
============
> ===============================#
> 
> 
> 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)
> #====    test.pl =====#
> #!/usr/bin/perl

On Windows (with ActivePerl) this is just #!perl

> 
> use strict;
> use warnings;
> use Template;
> $| = 1;
> 

# You need to send the HTTP header
#
print "Content-Type: text/html\n\n"

> my $config = {
> 	INCLUDE_PATH	=> 'C:\\Sites\\testnet\\src',
> 	INTERPOLATE	=> 1,
> 	POST_CHOMP	=> 1,
> 	PRE_PROCESS	=> 'header.inc',
> 	EVAL_PERL	=> 1,
> };
> 
> my $t = Template->new($config);
> 
> my $vars = {
> 	title	=> 'TT Test',
> 	var1	=> 'blah',
> };
> 
> my $input = 'test.tt';
> 
> $t->process( $input, $vars ) || die $t->error();
>
############################################################
###
> 
> #===  header.inc  ===#
> <?xml version="1.0"
encoding="UTF-8"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN"
> "htt
p://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
;
> 
> <html xmlns="http://www.w3.org/1999/x
html" xml:lang="en"
lang="en">
> 
> <head>
> <title>
> [% title %]
> </title>
> </head>
> 
>
############################################################
###
> 
> #===   test.tt   ===#
> <body>
>  <h1>[% title %]</h1>
>  <p>This should print "blah": [% var1
%]</p>
> </body>
> </html>
> 
>
############################################################
##


_______________________________________________
templates mailing list
templatestemplate-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/t
emplates
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )