Sergey Martynoff wrote:
> So I tried to put
> $context->process( sub { 'my text' } ); into 'new' method of my
> plugin. But it does not work - no output is produced.
The context will have processed the template and returned the output
text ('my text') to the caller. But unless the plugin does something
with it, this text will just disappear. TT doesn't automatically pipe
all output back to the user.
> So I'm asking for TT guru's advice - is this trick possible
> anyway?
No. The new() method is for creating plugin objects (or other values)
which get assigned to variables. You can return some text from a
plugin new() method, but then you have to explicitly print (i.e. GET)
the value in the template.
[% USE SomeText %] # sub new { return 'some text' }
[% SomeText %] # some text
Cheers
A
_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates