A recent thread spoke about adding a CHOMP directive.  I'd like
to take that a bit further, but also to clean it up a bit.  I
don't think that it would be too possible to add it fully in
TT2, (maybe we could - I'd be willing to do the coding to try).
I'd like to see the details get nailed down so that the feature
can be ready for TT3, and I'd like to add it in CGI::Ex::Template
as well.

The proposal would be to have a central CONFIG directive, that
all other configurations could be passed through.  It would change
the options during the COMPILE phase for some options, and
would allow for runtime options for other items.

The following are some samples of options during compile:

    [% GET foo %]
    [% CONFIG
          ANYCASE     => 1
          PRE_CHOMP   => '-'
          POST_CHOMP  => '~'
          TAGS        => 'html'
          INTERPOLATE => 1,
    %]
    <!-- get foo -->
    <!-- TAGS default -->
    [% get foo %]

The following would be some samples of runtime options - I
think that they would have to be enabled with a new flag along
the lines of ALLOW_RUNTIME_CONFIG => 1 (default 0) - otherwise
the directive should die:

    [% CONFIG
          INCLUDE_PATH => ['/home/user/templates']
          EVAL_PERL    => 1,
    %]

If that is the case then, it would then be nice to drop priveledges
also:

    [% CONFIG
        ALLOW_RUNTIME_CONFIG => 0
    %]

I think that once it was turned off - it couldn't be turned back
on - or better yet - run time options should be lexical - so that
if you call PROCESS - they are permanent - but if you call INCLUDE
then the options would only be in effect during the include.

It would also be nice to be able to query the options - but this would
probably be best done through the "template" variable.

    [% can_perl = template.config('EVAL_PERL') %]
    [% current_path = template.config('INCLUDE_PATH') %]

The INCLUDE_PATH variables should probably not be available unless
the ALLOW_RUNTIME_CONFIG variable is set.

Any other ideas?

Paul

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to