On Tue, Jun 12, 2001 at 08:48:58AM -0400, Drew Taylor wrote:
> Count me in for this feature too. It bugs me that I have a whole large 
> directory structure to store my 2 levels of templates.

There are a couple of problems with this.  This first is that you could
have more than one directory in your INCLUDE_PATH with the same file.
e.g.

my $tt2 = Template->new({
    INCLUDE_PATH => '/foo:/bar',
    COMPILE_DIR  => '/tmp/tt2',
});

The file 'baz' could exist as both '/foo/baz' and '/bar/baz' but you would
lose that distinction if you cached them as '/tmp/tt2/baz' instead of 
'/tmp/tt2/foo/baz' and '/tmp/tt2/bar/baz'.

You could argue that this is no big deal because the template should only
match against the first directory in the INCLUDE_PATH that contains it,
e.g '/foo/baz', but therein lies the second problem.  You could start a
new TT processs using the same COMPILE_DIR but with a different INCLUDE_PATH
order, e.g. '/bar:/foo'.  Now 'baz' should match '/bar/baz' but instead
you have a compiled version of '/foo/baz'.

So if you wanted to do this, then I guess we would need some other way 
of indexing compiled files to their original source template filenames.
I'm sure such a thing would be possible... patches welcome :-)

A


-- 
Andy Wardley <[EMAIL PROTECTED]>   Signature regenerating.  Please remain seated.
     <[EMAIL PROTECTED]>   For a good time: http://www.kfs.org/~abw/


Reply via email to