I just uploaded a new version of Template::Alloy that has this support. You
will have to set STREAM => 1 to enable it. It was actually very simple and
quick to implement - but writing the tests and edge cases took a bit more
time.
Paul
use Template::Alloy 1.010;
my $ta = Template::Alloy->new(STREAM => 1);
my $template = qq{Here we go
[%- FOR a IN ['A' .. 'C'] %]
[%- FOR i IN [1..3] %]
[% sleep %][% a %] - [% i %]
[%- END %]
[%- END %]
};
my $vars = {
sleep => sub { sleep(shift || 1); ''},
};
$ta->process(\$template, $vars) || die $ta->error;
> Kelly,
>
> Actually, the output is not a webpage. Imagine for a second that the
> output is an LED sign and, say, I'm trying to output a countdown clock that
> goes "10", "9", "8", etc. and sleeps one second between each second. What
> I don't want is 10 seconds of nothing, then suddenly $output being "10 9 8
> 7 6 5 4 3 2 1 0". I want to receive the "10", then it will wait 1 second,
> then send me the "9", then wait one second, etc.
>
> I could do that with a "WRITE" command where anything destined to go to the
> LED sign is sent through that, which would work in real-time, but my
> question is whether that could be done by overriding the normal standard
> output method so I wouldn't have to re-do thousands of templates.
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates