I'm a Perl beginner, so forgive me, but I added these lines to
Template::Context -

Line 811:
   # VIEWS
    my $views_map = $config->{ VIEWS };
    while ( my ( $key, $val ) = each %$views_map ) {
        my $_tt_view = $self->view($val);
        $self->{ STASH }->set($key, $_tt_view);
    }

which allows me to do -

my $context = Template::Context->new(
    {
        STAT_TTL     => 1,
        VIEWS        => { default => { prefix => '', }, },
    }
);

my $template = Template->new( { CONTEXT => $context, } )
  or die "$template::ERROR\n";

$template->process('test');

and lets me use "default" as a View normally.

As I am still relatively new to Perl (and TT internals), can someone take a
brief look at this?  It appears to work, but I'm not 100% confident..

Basically, my idea is to save some time off every template->process on an
Apache2 server by doing it once.

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

Reply via email to