Hi,
It would be useful if assigning to the CONSTANTS hash in a template
could be caught, maybe under STRICT or DEBUG options
e.g:
-------------------------------------------------
...
my $tt = Template->new({
CONSTANTS => {
title => 'A Demo Page',
},
});
...
-------------------------------------------------
[% constants.title %]
[% constants.title = "wibble" %]
[% constants.title %]
-------------------------------------------------
which tt2 tolerates with narry a wimper :
-------------------------------------------------
A Demo Page
A Demo Page
-------------------------------------------------
DEBUG gives some clues:
...
$stash->set(['constants', 0, 'title', 0], 'wibble');
...
Obviously, 'constants' can be altered by CONSTANTS_NAMESPACE which Stash
would now be interested in.
Else an extra check in Stash::set might_just_do_it...?
This cropped up as, in the pursuit of performance, I can probably move
nearly 100% of the template variables to CONSTANTS.
With exceptions, to catch the exceptions, this could be as
straightforward as the previous move to STRICT.
Thoughts and suggestions welcome,
Regards,
David T
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates