At 09:31 AM 01/25/02 +0000, Andy Wardley wrote:
> package My::Template;
> use Template;
>
> sub new {
> Template->new({
> INCLUDE_PATH => [ '[% project.src %]', '[% project.lib %]' ],
> PRE_PROCESS => '[% project.pre_process %]',
> });
> }
...
>Then you just change your CGI scripts to do this:
>
> my $tt = My::Template->new();
I'm not really clear why sub classing is better than just saying in my CGI
(template) file:
[%- META noformat = 1 -%]
#![%- perl -%] -w
use lib '[% plugin_lib %]';
my $tt = Template->new( [% template_options %] );
And then in my config I set something like:
perl = "/usr/local/bin/perl"
plugin_lib = "$ttlib"
template_options = "
INCLUDE_PATH => '$ttlib',
PRE_PROCESS => 'config.dev',
PLUGIN_BASE => 'Plugin',
PRE_CHOMP => 1,
POST_CHOMP => 1,
TRIM => 1,"
BTW -- is there any reason why there could not be a template processing
option of, say, PLUGIN_LIB (or PERL5LIB?) to save typing:
use lib '[% plugin_lib %]';
Thanks,
--
Bill Moseley
mailto:[EMAIL PROTECTED]