[Templates] Is there a way to disable Plugins?
Sean McAfee
eefacm at gmail.com
Mon Jul 14 18:55:49 BST 2008
On Sun, Jul 13, 2008 at 10:23 PM, <chakkit at ibiz.co.th> wrote:
> Dear All,
>
>
>
> 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?
>
> Derive your own plugin provider from Template::Plugins that declines
requests you don't want fulfilled. Here's one that declines everything:
use Template;
use Template::Plugins;
use Template::Constants;
use strict;
package MyPlugins;
our @ISA = qw(Template::Plugins);
sub fetch {
return (undef, Template::Constants::STATUS_DECLINED);
}
package main;
my $t = Template->new({ LOAD_PLUGINS => 'MyPlugins' });
$t->process(\'[% USE Date %]') or die $t->error;
This dies with "plugin error - Date: plugin not found".
--Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.template-toolkit.org/pipermail/templates/attachments/20080714/eafb47f5/attachment.htm
More information about the templates
mailing list