NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Template::Plugin::Dumper (Score:2, Informative)
Re:Template::Plugin::Dumper (Score:1)
Template::Plugin::Dumper works great providing you know the name of the datastructure you want to dump - there's no way of dumping out the original datastructure you passed down in the process directive unless you do something like
$template->process($tplfile, { mydata => $real_ds_ref });, sticking[% Dumper.dump(mydata) %]in your template, and updating all your other template variables accordingly.My colleague didn't want to have to do this (or force
$real_ds_refto contain a reference pointing back to a copy of itself), and just see everything that was being passed down without any additional fuss.Hence the stash-poking described above. ;-)
Having said that, it's probably possible to patch TT2 to force it's internal
[% template %](for instance) to contain a reference back to the original datastructure, but to be honest I'm not sure that that's desirable or even useful, because internally everything then gets munged into the stash and the template contructed from that. It certainly wouldn't help debugging the[% component %]issue mentioned above...Reply to This
Parent
Re:Template::Plugin::Dumper (Score:1)
Whilst I remember, the answer to the question "why not just dump the stash?" goes something like, "you could do that, but you'll end up dumping out all the other stash stuff which you probably wouldn't want. A better solution would be to write a template plugin to essentially do that, but filter out the stash stuff TT2 adds".
It was this point I thought, "blow that". ;-)