Re: [Templates] TT on a Windows system

2004-04-12 Thread Harald Joerg
"Roderick A. Anderson" <[EMAIL PROTECTED]> writes: > [...] > When I use a simple > > $tt->('filename.tt', $MyVars); > > I get no output [...] Most likely you want to replace this with $tt->process('filename.tt', $MyVars); -- HTH, haj __

RE: [Templates] Incorporating existing sub's with print statements into templates

2004-04-12 Thread Jm Valera
Rather than using print statements, copy all of your method's output into a variable and return the content of that variable to template toolkit.   IE:   sub generate_my_table() {       my $output = '';       return $output }   Note that this is not ideal and you should let template toolkit

Re: [Templates] Incorporating existing sub's with print statements into templates

2004-04-12 Thread Perrin Harkins
On Mon, 2004-04-12 at 18:24, Matthew Haines wrote: > The &generate_my_table sub is full of print statements that print > straight to STDOUT. That is unfortunate. Not to worry though -- [% PERL %] blocks automatically tie STDOUT and capture the output. Try this: [% PERL %] my $dbh = $stash->get(

[Templates] Incorporating existing sub's with print statements into templates

2004-04-12 Thread Matthew Haines
I am trying to slowly migrate an application to TT and have run into the following problem for which I hope there is an easy and standard solution someone can point me to.   I have a large number of existing subroutines that print out HTML.  Usually these subroutines generate the HTML for a

Re: [Templates] WHILE bug-o-feature

2004-04-12 Thread Simon Wilcox
On Mon, 12 Apr 2004, Aleksandr Guidrevitch wrote: > Thanks Dave for a good try, but I have my > own iterator (similar to Class::DBI::Iterator), > which returns next value only by calling iterator.next, > so it wouldn't work. Well if it's your own iterator, why not add a C method so that you can

Re: [Templates] WHILE bug-o-feature

2004-04-12 Thread Aleksandr Guidrevitch
Dave Cash wrote: Well, the for me the problem is more complicated: I have iterator which returns numbers: [% WHILE (var = iterator.next) %] ... [% END %] If iterator.next returns 0 the loop fails :( If your iterator is a Template::Iterator, you can just do: [% FOREACH var IN iterator %][% va

Re: [Templates] WHILE bug-o-feature

2004-04-12 Thread Dave Cash
On Mon, 12 Apr 2004, Aleksandr Guidrevitch wrote: > Dave Cash wrote: > > > > >How about this? > > > > [% avar = [0,1,2] %][% WHILE avar.size %][% avar.shift %][% END %] > > > > > Well, the for me the problem is more complicated: I have iterator which > returns numbers: > [% WHILE (var = iterator.n

Re: [Templates] WHILE bug-o-feature

2004-04-12 Thread Aleksandr Guidrevitch
Dave Cash wrote: How about this? [% avar = [0,1,2] %][% WHILE avar.size %][% avar.shift %][% END %] Well, the for me the problem is more complicated: I have iterator which returns numbers: [% WHILE (var = iterator.next) %] ... [% END %] If iterator.next returns 0 the loop fails :(