[Templates] configuration files
Perrin Harkins
perrin@elem.com
28 Oct 2003 19:17:05 -0500
On Tue, 2003-10-28 at 18:42, Cahill, Earl wrote:
> 1. I am wondering about a good way to handle conf files. I would
> like to be able to do something like this
>
> --index.html
> [% conf = INCLUDE values.conf %]
> ...
> bgcolor = [% conf.bgcolor %]
Are you using Apache::Template? Because otherwise, I think you'd be
much better off doing your config stuff on the Perl side before you call
TT.
Even if you are using A::T, you could subclass it and add your own
configuration data to it from the Perl side. There is an example of
this in the docs.
> 2. I would like to have key fallback on conf files. So tt will keep
> processing conf files till it finds my key.
This is also easy to do if you do it in Perl before you call TT.
Assuming you have a hash of default values and a hash of overrides:
my %values = (%defaults, %overrides);
- Perrin