[Omaha.pm] Template Toolkit & CGI::Carp

Jay Hannah jhannah at omnihotels.com
Mon May 9 07:51:00 PDT 2005


Bummer. I do this all the time:

   use CGI::Carp qw( fatalsToBrowser );

It's awfully handy. I'm a Template Toolkit newb, but I'd expect this to work:

   my $template = Template->new({
      INCLUDE_PATH => $self->get_INCLUDE_PATH,
      INTERPOLATE  => 1, 
   });
   $template->process($file,$vars) || die $template->error;

But it doesn't. Somehow CGI::Carp can't catch that die (the die output ends up the Apache log). 

   (Maybe this has something to do with it?
    http://template-toolkit.org/pipermail/templates/2001-August/001399.html)

So the poorest poor man's CGI::Carp ever:

   $template->process($file,$vars) || print "<h1>" . $template->error . "</h1>";

It works.

Grin,

j




More information about the Omaha-pm mailing list