Scott Penrose > Template-Provider-MD5-0.01 > Template::Provider::MD5

Download:
Template-Provider-MD5-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

Template::Provider::MD5 - MD5 Cached Compiled SCALARS for Template Toolkit

SYNOPSIS ^

        use Template::Provider::MD5;
        use Template;

        # NOTE: Config is shared between Providers and Templates there is no
        # clear separation.

        my $config = {
                INCLUDE_PATH    => "Some/Include/Path",
                EVAL_PERL       => 0,
                COMPILE_DIR     => "/var/tmp/TTCache",
                COMPILE_EXT     => '.ttc',
        };

        # MAke your provider first, otherwise Template will make one for you.
        my $p = Template::Provider::MD5->new($config);
        $config->{LOAD_TEMPLATES} = [$p];
        $config->{PREFIX_MAP} = {default => 0};
        my $tt = Template->new($config);

        ... use $tt as per standard Template Toolkit ...

DESCRIPTION ^

Extension for Template Toolkit to cache SCALAR Templates by using MD5. A Template::Provider is actually designed to provide an alternate method for getting data (eg: the example is a WEB Access Module). In this case it is actually a replacement to the default Template::Provider by providing caching for strings and then falling back to the original when required.

METHODS ^

There are no public methods. They are all consumed by Template Toolkit

TODO ^

There are various things to do including:

Alternate Hashing

There is no reason just to use MD5, this should be either something that can be passed in or you could inherit this and pass in an alternate hashing.

Directory Hashing

Template Toollkit standard provider has a directory cache hashing by using the name of the file. This one is all in one directory, which is, well, obviously bad if you have LOTS of files. Generally speaking once unix hits 1000 files in a directory you start noticing serious degradataion in performance of a simple file operation (eg: -f).

SEE ALSO ^

Template

AUTHOR ^

Scott Penrose <scottp@dd.com.au> OR <scott@cpan.org>

COPYRIGHT ^

Copyright (c) 2004 Scott Penrose. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. (Artistic License and LGPL).

syntax highlighting: