Bradley Baetz wrote:
> Yeah, but this is from perl. I don't want to process this - I wnt to do
> this up front, before any processing. Its the top level file, not
> something PROCESSed later.

The context template() method is what you're looking for.

You can get the context via the context() method of the Template
object.

> And I still couldn't differentiate between syntax errors, and file not
> found - I can do the [% TRY %] equivelent in the perl directly.

You need to look for a 'file' error that is prefixed 'parse error: '.

  eval {
      my $file = $tt->context->template('foobar.html');
  };
  if ($@) {
      my $error = $@;
      my ($type, $info) = $error->type_info();
      
      if ($type eq 'file' && $info =~ s/^parse error: //) {
          print "parse error, dude: $info\n";
      }
      else {
          print "regular error, fella: $info\n";
      }
  }

HTH
A

  

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

Reply via email to