Hi,

I'm trying to figure out how to read a compiled template file from disk
without attempting to write as well.

I was originally going to use COMPILE_EXT & COMPILE_DIR to write and read
the compiled files, but the server the files will be hosted on does not
allow writing to disk from a script. I have noticed in the TT
documentation that "Compiled templates can be reloaded by a simple call to
Perl's require(), leaving Perl to handle all the parsing and
compilation.", but I can't figure out how to make this work.

It's my understanding that using COMPILE_EXT & COMPILE_DIR will only try
to write to disk if the compiled files are older than the uncompiled
template files, so I thought I might try outputting the compiled files
using ttree. This appears to work, but the files get auto-copied to the
server, so I have no control over what the modified time on them will be.

The cgi file I'm working with is pretty basic:
        my $config = { INCLUDE_PATH => [ '../', './' ] };
        my $file = 'myfile.ttm';
        my $data;
        my $template = new Template($config);

        print "Content-Type: text/html\n\n";
        $template->process( $file, $data ) or die;

The compiled file is in a separate directory, stored as 'myfile.ttm.ttc'.

Any suggestions?

--Noah



_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to