package Apache::MyTemplate; use strict; use Apache::Constants qw( :common ); use Template; use vars qw( $TT ); sub handler { my $r = shift; # create or reuse existing Template object $TT ||= Template->new({ INCLUDE_PATH => '/usr/local/tt2/templates', }); my $data = { uri => $r->uri, copyright => '© 2002 Andy Wardley', weblinks => [ { url => 'http://perl.apache.org/', title => 'Apache/mod_perl', }, { url => 'http://tt2.org/', title => 'Template Toolkit', }, ], # ...and so on... }; $r->content_type('text/html'); $r->send_http_header; $TT->process('example.html', $data, $r) || do { $r->log_reason($TT->error()); return SERVER_ERROR; }; return OK; } 1;