Re: Another Template Toolkit Q

2001-01-29 Thread Jonathan Stowe

On Mon, 29 Jan 2001 [EMAIL PROTECTED] wrote:

>
> So TT nicely allows a filename, a filehandle or blank for STDOUT.
>
> So how to I capture the output to "some variable" so I could, say,
> manipulate that output
> without having to read the file I've outputted?
>

$tt->process($template,$variables,\$outvar);

$outvar will contain the output.

/J\
-- 
Jonathan Stowe   |
http://www.gellyfish.com |   I'm with Grep on this one
http://www.tackleway.co.uk   |




RE: Another Template Toolkit Q

2001-01-29 Thread Neil Ford

>>
>>Hang on, isn't there an actual Template Toolkit mailing list.
>>
>>--
>>Richard Clamp <[EMAIL PROTECTED]>
>>

There is? Well I know when I'm not wanted then :-)

Mark k.

Check http://www.tt2.org/info.html#lists for details.

And it's not that you're not wanted :-) it's more that you're likely 
to get more authorative answers there.

Neil.
-- 
Neil C. Ford
[EMAIL PROTECTED]
http://www.binky.ourshack.org



Re: Another Template Toolkit Q

2001-01-29 Thread Robin Szemeti

On Mon, 29 Jan 2001, you wrote:
> 
> 
> So TT nicely allows a filename, a filehandle or blank for STDOUT.
> 
> So how to I capture the output to "some variable" so I could, say,
> manipulate that output
> without having to read the file I've outputted?

you just pass it a scalar ref

my ($stuff);
eg  $tt->process('prices.tt2', $vars, \$stuff );

and lo .. it ends up in $stuff.



-- 
Robin Szemeti

The box said "requires windows 95 or better"
So I installed Linux!



Re: Another Template Toolkit Q

2001-01-29 Thread Struan Donald

* at 29/01 15:29 - [EMAIL PROTECTED] said:
> >>mmm, this should be a FAQ... 
> >> 
> >>perldoc Template: 
> >>struan 
> >> 
> >>(sho missed this fisrt time round too :) 
> >> 
> 
> Thanks for the pointers, call me lazy, isn't that supposed to be a trait
> of a good programmer? ;-) 

only for certain values of lazy :)

struan



RE: Another Template Toolkit Q

2001-01-29 Thread Mark . Kitching
Title: RE: Another Template Toolkit Q





>>mmm, this should be a FAQ...
>>
>>perldoc Template:
>>struan
>>
>>(sho missed this fisrt time round too :)
>>


Thanks for the pointers, call me lazy, isn't that supposed to be a trait of a good programmer? ;-)


Mark K.





RE: Another Template Toolkit Q

2001-01-29 Thread Mark . Kitching
Title: RE: Another Template Toolkit Q





>>
>>Hang on, isn't there an actual Template Toolkit mailing list.
>>
>>-- 
>>Richard Clamp <[EMAIL PROTECTED]>
>>


There is? Well I know when I'm not wanted then :-)


Mark k.





Re: Another Template Toolkit Q

2001-01-29 Thread Struan Donald

* at 29/01 15:17 - [EMAIL PROTECTED] said:
> 
> So TT nicely allows a filename, a filehandle or blank for STDOUT. 
> 
> So how to I capture the output to "some variable" so I could, say,
> manipulate that output 
> without having to read the file I've outputted? 
> 
> Is that possible? 

mmm, this should be a FAQ...

perldoc Template:

   By default, the processed template output is printed to
   STDOUT.  The process() method then returns 1 to indicate
   success.  A third parameter may be passed to the process()
   method to specify a different output location.  This value
   may be one of: a plain string indicating a filename which
   will be opened (relative to OUTPUT_PATH, if defined) and
   the output written to; a file GLOB opened ready for
   output; a reference to a scalar (e.g. a text string) to
   which output/error is appended; a reference to a
   subroutine which is called, passing the output as a
   parameter; or any object reference which implements a
   'print' method (e.g. IO::Handle, Apache::Request, etc.)
   which will be called, passing the generated output as a
   parameter.

If you note, the third paramater can be a ref to a scalar to which the
output is appended.

hth

struan

(sho missed this fisrt time round too :)



Re: Another Template Toolkit Q

2001-01-29 Thread Richard Clamp

On Mon, Jan 29, 2001 at 03:17:10PM -, [EMAIL PROTECTED] wrote:
> 
> So TT nicely allows a filename, a filehandle or blank for STDOUT.
> 
> So how to I capture the output to "some variable" so I could, say,
> manipulate that output
> without having to read the file I've outputted?
> 
> Is that possible?

istr if you give it a scalar reference, as the 3rd parameter, then it puts
it in there.

Hang on, isn't there an actual Template Toolkit mailing list.

-- 
Richard Clamp <[EMAIL PROTECTED]>