in reply to Template Toolkit - Output Template Name / Filepath as HTML Comment
Although i am quite sure this is possible (see Template::Provider) you probably do not want output these comments in your production environment as you will give clues away to any would-be attackers. Instead, why not just grep or ack for the markup in question? I have found this to be a very workable solution for tracking down templates. No need to add more code to your base.
UPDATE: this might work for you, but i still recommend using grep or ack:
Just touch any file to src/greeting.html relative to the location of this script.use strict; use warnings; use Data::Dumper; use Template; my $file = 'src/greeting.html'; my $vars = { message => "Hello World\n" }; my $tt = Template->new; $tt->process($file, $vars); my ($found) = keys %{ $tt->{SERVICE}{CONTEXT}{LOAD_TEMPLATES}[0]->{LOO +KUP} }; print "$found\n";
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Template Toolkit - Output Template Name / Filepath as HTML Comment
by cjoy (Initiate) on Jun 25, 2015 at 18:17 UTC |