|
Posted by Ben Morrow on February 25, 2008, 6:01 pm
Please log in for more thread options
Quoth gmail@indigorobot.com:
> Hello everyone,
>
> I'm working on coding up a mod_perl handler, but am unable to get
> HTML::Template to output. Below is my current code:
>
> # file:MyHandler.pm
> #------------------------------------------------------------------
> package MyHandler;
>
> #Load some helpful functions
> use strict; #strict tolerance for code
> use warnings; #extra warnings in the log
> use Carp; #verbose logging
> use diagnostics; #more verbose logging
>
> #Loadup some functions for later use
> use HTML::Template;
>
> #Loadup functions involved in being a handler
> use Apache2::RequestRec ();
> use Apache2::RequestIO ();
> use Apache2::Request;
> use Apache2::Const -compile => qw(OK);
>
> #------------------------------------------------------------------
> #
> # Subroutines
> #
>
> sub handler {
> my $hdlr = shift;
> $hdlr->content_type('text/html');
> $hdlr->print("Handler started<br />");
>
> my $template = HTML::Template->new( filename => "/templates/
> main.tmpl");
> $hdlr->print("outputting template...<br />");
> $template->output();
HTML::Template is writing to STDOUT. You need to tell it to write to the
handler; possibly
$template->output(print_to => $hdlr);
?
Ben
|