[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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