in reply to Appending to Template Toolkit

Have you looked at the Template::process documentation? It tells you how to do what you want.

Replies are listed 'Best First'.
Re^2: Appending to Template Toolkit
by Anonymous Monk on Mar 07, 2011 at 19:59 UTC
    I couldn't find anything that allowed me to append to a line like this:
    $onscreen .= $template->process('screen.html', $temp_data) || di +e $template->error( );
    I need to bring this piece of html file with the $date in it into $onscreen so the rest of the code finished its processing.

      Then read the section again. Maybe searching for the word "append" helps. I'm not sure how I could tell things clearer than the documentation already does, which is why I'm pointing you to it instead of regurgitating it here.

        No problem in helping you!Here it is, try this way:
        #!/usr/bin/perl -w use strict; use Template; ... my $template = Template->new( ); my $temp_data = {}; # set variales for template ... # here is how I did for HTML::Template #$template->param(my_date => $date); #$onscreen .= $template->output; # process template with tt $temp_data->{'my_date'} = $date; $template->process('screen.html', $temp_data, \$onscreen) || di +e $template->error( ); ... $onscreen .="</table>";
        Let me know if works!

      One note - you will probably run into precedence issues with || vs. or. See perlop for more information.

      --MidLifeXis