[Templates] Is there a way to disable Plugins?

chakkit at ibiz.co.th chakkit at ibiz.co.th
Mon Jul 14 20:38:32 BST 2008


Thanks Josh,

This is most quick and easy method.

Chakkit


chakkit at ibiz.co.th wrote:
> I'm planning to develop a system that public users can fully change the 
> template by their own.
> 
> I'm concerning about security, how can I turn off some plugins or load 
> only what I need?

use Template;
use Template::Plugins;

$Template::Plugins::STD_PLUGINS = {};
$Template::Plugins::PLUGIN_BASE = '';

Then just define your plugins via the PLUGINS config option.

my $template_config = {
  PLUGINS => {
    'math' => 'Template::Plugin::Math',
  }
};
my $template = Template->new($template_config);

-- Josh




More information about the templates mailing list