Re: [Templates] tt->process(url) ?

[prev] [thread] [next] [Date index for 2004/12/29]

From: Dave Cross
Subject: Re: [Templates] tt->process(url) ?
Date: 08:13 on 29 Dec 2004
On Tue, Dec 28, 2004 at 11:23:55AM -0800, Ken A wrote:
> Hello,
> 
> I'm trying to use TT to process templates on another server.
> Can process method take a url?
> 
> Instead of this:
> $tt->process('welcome.tt2')
> 
> Can I do this:
> $tt->process('http://someotherhost/welcome.tt2')

From "perldoc Template"

  The process() method is called to process a template. The first
  parameter indicates the input template as one of: a filename relative
  to INCLUDE_PATH, if defined; a reference to a text string containing
  the template text; or a file handle reference (e.g. IO::Handle or sub-
  class) or GLOB (e.g. \*STDIN), from which the template can be read.

So, no, you can't pass it a URL.

> Or do I need to use LWP to fetch the $page then feed it to process() 
> like so?

That's right. 

> $tt->process('\$page')

Er... that's not going to do what you mean. I think you want

  $tt->process(\$page)

The single quotes are going to convert your argument into a string
containing the literal characters \$page - which TT will then interpret
as the name of a file containing the template.

hth,

Dave...

        -- 
          If you miss an opportunity to see him perform... you're a total asshole.
  David Cross rocks my world.
    -- Jack Black

_______________________________________________
templates mailing list
templates@xxxxxxxxxxxxxxxx.xxx
http://lists.template-toolkit.org/mailman/listinfo/templates

[Templates] tt->process(url) ?
Ken A 19:23 on 28 Dec 2004

Re: [Templates] tt->process(url) ?
Dave Cross 08:13 on 29 Dec 2004

RE: [Templates] tt->process(url) ?
Jason Gottshall 18:45 on 03 Jan 2005

Generated at 08:55 on 15 Mar 2005 by mariachi v0.52