Questions tagged [template-toolkit]

The Template Toolkit is a fast, flexible and, highly extensible template processing system for Perl. There are also Python and JavaScript implementations.

template-toolkit
Filter by
Sorted by
Tagged with
19 votes
1 answer
2k views

How can I handle hash keys containing illegal identifier characters in Template Toolkit?

In Template Toolkit, if I have the following variable containing a hashref: [% artist = { 'life-span' => '1975 to 1987', } %] What is the best way to output the data in 'life-span'? ...
nick's user avatar
  • 1,379
7 votes
3 answers
3k views

Calling outside subs and modules in Template Toolkit without Plugins?

I am trying to call an outside Perl module in a Template Toolkit .tt file. The module I want to use is Util, and I want to call Util::prettify_date. I was able to include this module using Template ...
Sam Lee's user avatar
  • 7,099
15 votes
5 answers
7k views

Perl: Alternatives to template toolkit

I have been using template toolkit for extending an existing domain specific language(verilog) for over 3 years now. While overall I am happy with it, the major irritant is that when there is a syntax/...
vijayvithal's user avatar
15 votes
2 answers
3k views

Can Perl's Template Toolkit warn on undefined values?

Is there a way to make Perl's Template display warnings for all undefined values that I attempt to use the GET directive on (via [% %]) during Template::process? The default behavior is to ignore and ...
cdleary's user avatar
  • 70.6k
10 votes
3 answers
918 views

How do I handle errors in methods chains in Perl?

What is the best way to deal with exceptions threw in a method chaining in Perl? I want to assign a value of 0 or undef if any of the methods chained throw an exception Code sample: my $x = $obj->...
nsbm's user avatar
  • 5,962
6 votes
3 answers
1k views

I get extra CR using TT (perl template toolkit)

I use perl v5.10 (on windows 7) + TT v2.22. When I use TT, for each source line, I get in the produced html an extra CR : Source text (windows format): "Some_html" CR LF Output text : "...
gerard's user avatar
  • 1,943
6 votes
2 answers
3k views

How do I get a random number in template toolkit?

I want to get a random number using template toolkit. It doesn't have to be particularly random. How do I do it?
Sam Lee's user avatar
  • 10.2k
3 votes
2 answers
379 views

BASH: importing data from flat file into template

I have a flat file of records, each 33 lines long. I need to format this file to specs in a template. The template is in DOS format while the source file is in NIX format. The template has specific ...
Bubnoff's user avatar
  • 4,047
3 votes
1 answer
299 views

Perl - Template Alloy and Template toolkit array ref

I using template alloy and Template toolkit, in TT I want to detect array reference like i do with perl: for my $parents ( @{$value} ){ if (ref($parents) ne 'ARRAY'){ push @all_urls_names, $...
Imylor's user avatar
  • 384
3 votes
3 answers
3k views

AJAX: how to get progress feedback in web apps, and to avoid timeouts on long requests?

This is a general design question about how to make a web application that will receive a large amount of uploaded data, process it, and return a result, all without the dreaded spinning beach-ball ...
David Dombrowsky's user avatar
3 votes
2 answers
1k views

How to detect array type in Template toolkit? [closed]

I need to detect some variable for accessory to array type in Template toolkit. Are there best practices?
bibimij's user avatar
  • 117
3 votes
3 answers
3k views

List of paths into hash array tree in Perl

I got an array of paths C:\A C:\B\C D:\AB and I'd like to have these in a hash array tree so I can go through them in a TT2 template. What I mean is like this: @dirs = [ { ...
BloodyRain2k's user avatar
2 votes
1 answer
187 views

xslate/Catalyst::View::Xslate wrapper

I have a Catalyst application that uses TT for views: https://metacpan.org/module/Catalyst::View::TT and I would like to try out https://metacpan.org/module/Catalyst::View::Xslate We use the WRAPPER ...
user353255's user avatar
2 votes
1 answer
683 views

How to make a page-specific title in Dancer templates?

I have a standard Perl Dancer app, using Template::Toolkit as rendering engine, with two routes: get '/' => sub { template 'index'; }; get '/foo' => sub { template 'foo'; }; My views/...
Arry's user avatar
  • 965
2 votes
4 answers
3k views

Formatting timestamp field for output in TemplateToolkit

I'm using Perl with Catalyst framework, DBIx class as ORM, TT for views, Postgresql as DB. I have a column with 'timestamp without timezone' type, and if I do manual query in Postgres the column ...
kK-Storm's user avatar
  • 492
1 vote
1 answer
168 views

calling template from the other template

I am working on Catalyst MVC framework to create a web page for a database. I am not a full time programmer as such. But I know basics of perl and java. I am a biologist. I have written a template ...
user1462804's user avatar