On Jan 9, 2008 3:05 PM, Kate Yoak <[EMAIL PROTECTED]> wrote:
> Sure, I could parse the $Template::ERROR text - but it seems like there
> ought to be a better way to do it.

Template::Exception has a type, which may be useful to you.  I'd
suggest grep'ing the code to see what some possible types are when it
throws Template::Exception errors.

> I read a lot of documentation concerning using try/catch inside a template
> but none for how to do it in code. I tried the common try/catch syntax
> associated with Error.pm - but that doesn't work.

That only works with things that throw exceptions, which process()
does not.  It makes you check for a true return value and then look at
$tt->error() or $Template::ERROR.  I recommend avoiding Error.pm's
try/catch anyway, because of the error-prone sub ref prototype trick
it uses.

The error() method should give you a Template::Exception object, as
described here:
http://tt2.org/docs/modules/Template.html#method_error

- Perrin

_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to