Yussef Elsirgany <[EMAIL PROTECTED]> said something to this effect on 09/12/2001:
> Can anyone point out to me how I can return the output of process() to a
> variable in a perl script.
> I have been trying:
>
> BEFORE
> $tt->process($html_template, $vars, $output) || die $tt->error(), "\n";
> $tt->error(), "\n";
>
> NOW
> $output = $tt->process($html_template, $vars) || die $tt->error(), "\n";
> $tt->error(), "\n";
>
>
> On both cases output goes out to standard output and this is driving me
> nuts! Thanks all for your help.
I always use Template::Service objects, the process method of
which returns the data.
my $ts = Template::Config->service(\%params);
my $output = $ts->process($tmpl, $vars);
You can also pass a reference to a scalar as the third parameter
to Template::process, and it will put it into that variable. If
you pass a regular scalar, it assumes that it is a filename, which
is probably not what you want. Keep in mind that you can pass a
GLOB as the last variable (i.e., open filehandle).
(darren)
--
Man is condemned to be free; because once thrown into the world,
he is for everything he does.
-- Jean-Paul Sartre