Dotiac::DTL::Reduced - Dotiac::DTL without the parser.


        require Dotiac::DTL::Reduced;
        $t=Dotiac::DTL->new("compiled.html") #Works only with compiled templates


Dotiac::DTL::Reduced is a version of Dotiac::DTL that contains everything needed to run compiled templates. The other stuff, i.e. parser and Tags are not loaded, so it should save some memory.

I recon it makes almost no difference at all with mod_perl or FastCGI, but having all the tag modules parsed for nothing will impact normal CGI performance.

See Dotiac::DTL::Compiled for pros and cons of compiled templates.

Note This will only run compiled templates, if your compiled template includes a normal template, it will die.

It will also create a warning when the template is outdated and needs to be recompiled.

Compiling templates

Since Dotiac::DTL::Reduced will only work with compiled templates, you can use this litte script to compile all templates in the current folder:

        require Dotiac::DTL; #Not Reduced here, we need the parser for this.
        Dotiac::DTL->newandcompile($_) foreach (<*.html>); #You might have to change this to whatever file extension you are using.

But see Dotiac::DTL::Compiled before you do this to read up on compiled template pros and cons.

You will also have to recompile everytime you change something. The above script will only compile the changed files in that case.

Changes from the normal Dotiac::DTL

Everything discriped in Dotiac::DTL and Dotiac::DTL::Core still applies here except:


Creates a template from a compiled version or loads it from the cache.


The filename of the compiled template to open. If you give it a scalarref it will die.

        require Dotiac::DTL::Reduced;
        $t=Dotiac::DTL->new("file.html"); #Will load "" or die.

The COMPILE parameter from Dotiac::DTL->new() is ignored. It wouldn't work anyway

Returns a Dotiac::DTL::Template object.

And what about my own compiled templates?

This works like it should: (See Dotiac::DTL::Compiled)

        package MyTemplate;
        sub print {
                my ($vars,$escape)=(shift(),shift());
                print "There are ".keys(%$vars)." parameters registered and x is $vars->{x}\n";
        sub string {
                my ($vars,$escape)=(shift(),shift());
                return "There are ".keys(%$vars)." parameters registered and x is $vars->{x}\n";
        sub eval {
                #nothing for now.
        package main;
        require Dotiac::DTL;
        my $mytemplate=Dotiac::DTL->compiled("MyTemplate");


Creates a template from FILE. This function is for Django like syntax, use new(FILE) for better results and control.


This can be a filename or a string containing the template data.

Template() will search the current directory and @Dotiac::DTL::TEMPLATE_DIRS (See for either FILE, FILE.html or FILE.txt and open the first file found.

If no file is found it treats FILE as template data and will parse the string.


Python's Django uses Context() to create a Context, Dotiac::DTL doesn't use this, it just uses a hash.


A Hash of parameters.

Returns the first Argument.


If you find a bug, please report it.



Dotiac::DTL was built according to


Marc-Sebastian Lucksch