[Templates] Question around POD

[prev] [thread] [next] [Date index for 2004/06/10]

From: lio
Subject: [Templates] Question around POD
Date: 06:44 on 10 Jun 2004
I have question about
perldoc Modules::Template::Context

Truelly speaking I have not understood this part:

...
Thus you can compile templates to include PERL blocks, but optionally
disable them when you process them later.  Note however that it is
possible for a PERL block to contain a Perl "BEGIN { # some code }"
block which will always get run regardless of the runtime EVAL_PERL
status.  Thus, if you set EVAL_PERL when compiling templates, it is
assumed that you trust the templates to Do The Right Thing.  Otherwise
you must accept the fact that there's no bulletproof way to prevent
any included code from trampling around in the living room of the
runtime environment, making a real nuisance of itself if it really
wants to.  If you don't like the idea of such uninvited guests causing
a bother, then you can accept the default and keep EVAL_PERL disabled.
...

In template I have PERL block
[% PERL %]
BEGIN {
      print "achtung";
}
[% END %]

I compiled template with PERL block and options
EVAL_PERL => 1
COMPILE_DIR => '/some/path'
COMPILE_EXT => '.ttc'

Compiled template ready. Then I set
EVAL_PERL => 0
and process compiled template again. As expected 'perl' exception
raised and BEGIN {} block is not executed. Why in this pod you make
note about this. All seems to be safe. Or I have not understood
something? Please help.

Best regards,
Igor Lobanov



_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] Question around POD
lio 06:44 on 10 Jun 2004

Re: [Templates] Question around POD
Andy Wardley 08:34 on 10 Jun 2004

Generated at 08:56 on 15 Mar 2005 by mariachi v0.52