Josh Rosenbaum wrote:
> Jens Rehsack wrote:
>> Is there
>> a) a cute way to give code references to a function, or
>> b) a way to evaluate a MACRO from a function in a plugin?
> 
> Did you try to use '\' to use a reference?:
> [% my idx = mylist.firstidx( \funcs.numeq, 4, [ 1, 6, 9, 3, 4, 2, 5 ] ); %]

That works - great. I didn't know that TT2 can do that.

> I seem to recall seeing that in the code or docs somewhere, but my
> memory is hazy. I could be completely wrong, but don't have time to look
> into it. It's entirely possible that would only work for plain variables
> too.
> 
> As an alternative, you can evaluate a block by passing the block name to
> the plugin and using the context to process the block.

With name of block you mean sth. like "MyPkg::myFunc" - and I resolve that
in plugin using *{$_[0]}{CODE}? Or do you mean I can access the macros
defined in the template from plugin?

Jens

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to