>>Or do I need to do a print statement or ???
I'm not sure how you are using TT but if you don't want TT to print directly to STDOUT, you supply a scalar reference as the 3rd parameter.
use strict; use Template;
my $tt = Template->new();
my $output_flag = 0;
if ($output_flag == 0) {
# prints directly to STDOUT
$tt->process(\*DATA, { my_routine => \&my_routine }) || die $tt->error;} else {
# prints template results into $output
my $output;
$tt->process(\*DATA, { my_routine => \&my_routine }, \$output) || die $tt->error;
print "OUTPUT: $output\n";
}
sub my_routine {
my $t = shift;
return "You said $t";
}__DATA__
<P>[% my_routine("what's up") %]</P>At 01:33 PM 5/28/03 -0500, you wrote:
Quick question for the pros :
If I do :
sub my_routine { my $t = shift; return "You said $t"; }
$vars = { my_routine => \&my_routine };
... then in the template ...
<P> [% my_routine("my_arg here") %] </P>
Will that simply print the return value of my_routine, in this case : <P> You said my_arg here </P>
Or do I need to do a print statement or ???
Thanks
Dan
_______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
_______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates
