The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Maplat::Web::TemplateCache - provide template caching and rendering

SYNOPSIS

This module provides template rendering as well as caching the template files

DESCRIPTION

During the reload() calls, this modules loads all template files in the configured directory into RAM and renders them quite fast.

The template rendering can optionally use "meta" rendering with a base template. This is for example used to render the complete layout of a page, and modules only have templates that use only the changing part of the page - this way, you only have to have one global layout and only write the changing part of the page for every module.

Configuration

        <module>
                <modname>templates</modname>
                <pm>TemplateCache</pm>
                <options>
                        <view>
                                <path>MaplatWeb/Templates</path>
                                <base>/</base>
                        </view>
                        <view>
                                <path>some/other/relative/path</path>
                                <base>myothertemplates/</base>
                        </view>
                        <!-- Layout-Template to use for complete pages -->
                        <layout>maplatlayout</layout>
                </options>
        </module>

layout is the template name used in meta-rendering.

get

The one public function to call in this module is get(), in the form of:

  $templatehandle->get($name, $uselayout, %webdata);

$name if the name of the template file (without the .tt suffix)

$uselayout is a boolean, indicating if meta-rendering with the configured layout.

%webdata is a hash that is passed through to the template toolkit.

load_dir

Internal function.

Dependencies

This module is a basic web module and does not depend on other web modules.

SEE ALSO

Maplat::Web

AUTHOR

Rene Schickbauer, <rene.schickbauer@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2008-2010 by Rene Schickbauer

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.