LPM: Problems with text::template
Rich Bowen
rbowen at rcbowen.com
Thu Jun 22 21:38:13 CDT 2000
> David Pitts wrote:
>
> Okay, I am playing with text::template for the first time - thanks to
> Rich's discussion on it. I have a template that includes some perl...
> something like this:
>
>
> <TD bgColor={$newsbgcolor} width=3>
...
Just a few comments:
You're using { } in your template as your code delimiter. Don't. You'll
thank me later. There are two main reasons for this. First, { } will
mean other things in your template. Guaranteed. Second, using something
other than { } is actually a lot faster, for reasons explained in the
docs. If you're doing this in HTML (which you appear to be) use <% %> or
similar delimiters that are unambiguous.
In your templates, you probably want to append output to the $OUT
variable, rather than printing it. That's the recommended (by the
author) way to use the module. $OUT is guaranteed to make it into your
output in the expected place. print might not.
Rich
--
Rich Bowen - Rich at cre8tivegroup.com
Director of Web Application Development - The Creative Group
http://www.cre8tivegroup.com/
Author - Apache Server Unleashed - http://apacheunleashed.com/
More information about the Lexington-pm
mailing list