Perrin Harkins wrote:
>
> On Thu, 8 Jun 2000, Greg Cope wrote:
> > My original question was not related to templates (I'll use embperl for
> > that)
>
> Well, I'm confused now. You'll use Embperl for templates but you're not
> using Embperl for templates?
I use Embperl when I want a templating system - but not when using HTML
templates (wrong use of names on my part) - I am refering to a template
in this case as an HTML file with a few special tags.
>
> > - the area I was trying to explore was how to read a template (all
> > HTML with a few <!--TAGS--> in it) and the sub in the new content.
>
> Embperl would work fine for that, but it's overkill. Your substitution
> approach is slower than compiling to perl subs, especially since you have
> to load the file, but saves lots of memory and is fine for something as
> simple as this.
Can you enlighten me into the compiling to perl subs ?
The file gets loaded once into shared memory - most (stripped) HTML
files are only a few 10's of K.
Also the file gets loaded once at startup - not during the request
stage.
> > Has anyone any suggestions as to speeding this up - yet keeping it
> > simple - I have played with referances to avoid all the variable copying
> > etc . ?
>
> Caching templates in memory would certainly help, but you'll eat up a
> chunk of RAM.
If the html is usually reasonable in size, and the code I C&P'ed strips
the template into one long strip with spaces / tabs (designers making
things all indented etc ..) at each end of the string - and chomp.
Also the templates are modular - in that one template covers main part
of the page, and other templates cover the rest. This helps contiunity
in HTML design etc .. (i.e only make one changen in one place)
Thanks for the input.
Greg
>
> - Perrin