Sergey Martynoff wrote:
I still see that regexp /^[_.]/ for identifying "private" hash items (in 'item' hash vmethod, '_dotop' and '_assign' methods) - I think three times is enough for moving it to a separate method.
Good point, but we don't want to add another method call to anything happening in the stash. We would be adding a method call to each element of every dotop in every variable in every TT template in the world, and that adds up to a big hill of beans :-)
I've just checked in a patch which defines a $PRIVATE package variable containing a regex to match. It effectively does the same thing but without a method call. It also allows you to undefine $Template::Stash::PRIVATE if you want to disable these checks (i.e. then you can access _private or .hidden variables).
I've also patched the XS stash but in over an hour of searching, I can't find any document showing how to match a string against a pre-compiled regex from XS. So it hard-codes the search for '_' or '.' as before. However it does check to see if Template::Stash::PRIVATE is defined or not, effectively using it as a flag to enable/disable the feature.
Also, some vmethods (list 'sort' and 'nsort', hash 'item') still use complex constructs to access hash items. Few month ago I proposed to use _dotop in all that cases for the uniformity of code (however, this may decrease perfomance when sorting list of hashes).
Not sure what you mean by that. Feel free to send a patch though and I'll look it over.
And, anyway Schwartzian Transform (converting to lowercase) is redundant for 'nsort' vmethod :)
Yep, true.
If you consider this notes to be reasonable, I can make patches for all this things when I have a bit time :)
Sure thing. A _______________________________________________ templates mailing list [email protected] http://lists.template-toolkit.org/mailman/listinfo/templates
