Dotiac::DTL::Variable - Stores a Django template variable tag.


Template file:

        Some text.... 
        {{ variable }}
        Some other Text. {{ variable|lower }} Some more text.
        Even more Text.{{ "Quoted text"|lower }} End of Text.

Perl file:

        use Dotiac::DTL;
        my $template=Dotiac::DTL->new("template.file");
        $template->print({variable=>"Dynamic Text"});


Everything between the starting {{ and the next }} is treated a variable name. Stuff that doesn't belong to the first variable is silently ignored:

        {{ variable variable2 }} is the same as {{ variable }}

{{ variable|lower }} is a varible with a filter, see Dotiac::DTL::Filter for more details on filters. Everywhere a variable is requested you can also use a string and/or filters as these are considered to be part of the variable. Here shown with the tag cycle (Dotiac::DTL::Tag::cycle):

        {% cycle variable othervariable, "string with spaces, and even colons" %}
        {% cycle variablewithfilter|lower variablewithmorefilters|lower|addslashes %}
        {% cycle "string with a filter"|lower|addslashes "string with a filter with arguments"|cut:", " %}

The variable can not contain spaces, colons or other special chars, unless those are in quotes (single or double) They can never contain (for now) : %} and }}, depending on wether they are in a tag or standalone.

The module itself has no real use, it's just used by the Dotiac::DTL parser to store free standing variables. Variables in specific tags are stored in those.


If you find a bug, please report it.



Dotiac::DTL was built according to


Marc-Sebastian Lucksch