Are you saying that I'd have to break up all of my modules and put the subroutines into their own files with a .tt extension? So, I'd have to break up my Base::HTML where most of the base code for my site lives?
:| Are you calling me Shirley? |:
:|
Note the lack of humor in my facial expression ;D
Organizing templates in separate files is the most natural way to do it, but you're not limited to that approach
When you said tt2 would not do the templating you need, I assumed you couldn't find the argument passing portion of the manual, so I showed you a simple example, was I wrong?
If you wish to use Base::HTML from TT2 you could make a plugin
[% USE BaseHTML; # Template::Plugin::BaseHTML.pm
GET BaseHTML.print_definitions(
file => "some_file_a.txt",
headings => [ "term", "definition" ],
);
%]
Here is a running example $ cat dumper.tt
[% USE Dumper Indent = 1;
GET Dumper.dump(
file => "some_file_a.txt",
headings => [ "term", "definition" ],
)
%]
$ tpage dumper.tt
$VAR1 = {
'file' => 'some_file_a.txt',
'headings' => [
'term',
'definition'
]
};
Or you could use the Class plugin, simple running example
$ cat class.tt
[% USE q = Class('CGI');
GET q.start_form();
%]
$ tpage class.tt
<form method="post" action="http://localhost" enctype="multipart/form-
+data">
If the OOP-yness of Template::Plugin::Class doesn't quite work for you (since your base doesn't appear to be OO), its easy to modify to Template::Plugin::Class::Proxy::AUTOLOAD to remove $self
See also Template::Plugin, Template::Plugin::, Template::Plugin::Dumper, , Template::Plugin::Class, Template::Provider::Preload, Template::Provider::MD5, Template::Provider::Memory |