Dave Howorth wrote:In Template Toolkit, any hash key starting with an underscore is hidden from the template. Is there any way to turn this off?
No, not really.
Your best bet would be to replace the 'item' hash virtual method with one which honours underscore keys.
my $tt = Template->new(); $tt->context->define_vmethod( hash => item => sub { $_[0]->{$_[1]} } );
Then you can do this: [% hash.item('_') %]
Andy, Thanks very much for such a fast response. The suggested fix is perfect for me. As you will have seen from another post, the perl script outputs a message - "no such context method/member: define_vmethod" - as a result of which I started to upgrade TT.
It turns out the script keeps running despite the message, and produces the correct result! So I don't understand it, but I'm happy :)
Thanks again, Dave
PS I'm currently running TT '2.09c'; perl v5.6.1; Debian woody.
_______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
