[Templates] configuration files

Cahill, Earl earl@aboutws.com
Wed, 29 Oct 2003 12:13:11 -0500


> > 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.
> 

I hadn't been (still sort of a newbie) using A::T, but it looks like a
winner.  Currently, all my conf file type stuff is done on the Perl side,
but I was hoping I could easliy move it over to tt.  But, I think I like
your idea of just doing it in perl and tieing in from tt.

> > 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);

looks familiar

my %ARGS = (@DEFAULT_ARGS, @PASSED_ARGS);

Thanks, sounds like tied-in Perl might be the best way to go.

Earl