On Sat, Oct 18, 2008 at 9:51 AM, Mihai Bazon <[EMAIL PROTECTED]> wrote:
> Hi folks, > > I have an application where I want to allow end-users to write templates > but I don't want them to get access to all the available directives. For > instance I want to prevent them from using PROCESS / INCLUDE / WRAPPER / > USE, etc. They should only be able to access a controlled API. Is this > possible somehow? > Easily: use Template; use Template::Directive; use strict; package MyDirectives; @MyDirectives::ISA = qw(Template::Directive); sub process { die "PROCESS directive unavailable\n"; } package main; my $t = Template->new({ FACTORY => 'MyDirectives' }); $t->process(\*DATA) or die $t->error; __DATA__ [% PROCESS foo %] For every other directive you want to make unavailable, override another subroutine in the MyDirectives package and have it throw an exception. --Sean
_______________________________________________ templates mailing list templates@template-toolkit.org http://mail.template-toolkit.org/mailman/listinfo/templates