This is the sort of thing I was thinking of... it's quick and dirty
(*very* dirty), and really not worth even making into a module, but I did,
at least in theory (I haven't used it yet, and may never... I can't
actually remember the circumstances in which I thought it might be
useful).

It stomps all over any ability to use caching and whatnot, but that's okay
for me because anything that's using caching is already connected to the
database server and wouldn't need this sort of storage.  It also doesn't
make use of my suggestion to keep it enclosed in comment boundaries, but
it's really more of a "here's what I was talking about" sort of thing than
a "this might be useful in this form" sort of thing.


package HTML::Template::Config;

use strict;
use HTML::Template;

sub new { # file
  my $class = shift;
  my $filename = "";
  for (my $i = 0; $i <= $#_; $i += 2) {
    if (lc($_[$i]) eq "filename") {
      $filename = $_[$i+1];
      splice @_, $i, 2;
      last;
    }
  }
  open FILE, $filename;
  my @template = <FILE>;
  close FILE;
  my $template_param;
  while ($template[0] =~ /^(\w+?)\=(.+)$/) {
    $template_param->{$1} = $2;
    shift @template;
  }
  return wantarray
    ? (HTML::Template->new(arrayref => [EMAIL PROTECTED], @_), $template_param)
    : HTML::Template->new(arrayref => [EMAIL PROTECTED], @_);

}

1;


Templates would go something like:

fred=foo
bar=baz
<HTML><TMPL_VAR blah blah blah...

-- 
Karen J. Cravens  [EMAIL PROTECTED]



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to