perl - A method for changing INCLUDE_PATH in Template::Toolkit on the FLY -
if have preloaded template::toolkit object, in mod_perl enviroment example, there way change include_path array without recreating object?
i use template::provider this
my $template_config = { include_path => "/path/to/templates", encoding => 'utf8', }; # create template_provider manually can manipulate template path # later. $template_provider = template::provider->new($template_config); $tt = template->new({ load_templates => [$template_provider ], pre_chomp => 2, post_chomp => 3, trim => 1, encoding => 'utf8', }) || die $template::error; # somewhere else later $template_provider->include_path([ "$dir/templates/$language", "$dir/templates"]);
Comments
Post a Comment