Let's say I have the following Template Tookit template:

<html> <head><title>[% title %]</title></head> <body>[% INCLUDE "$site/$body" %]</body> </html>

If "$site/$body" is not found, I currently have a DEFAULT template set in the constructor:

my $template = Template->new( { INCLUDE_PATH => $some_include_path, DEFAULT => $some_default, PLUGIN_BASE => 'Onsite::Template::Plugin', OUTPUT => \$self->{_output} } );

The problem I have is that I want need to be automatically notified when a template fails to load (which is easy if I point the default template at a plugin), but I would like to know which template failed to load. In other words, with the above code, how would I pass the value of "$site/$body" to the $some_default template?

The only thing I've come up with is including the Data::Dumpered output of the Template object in the email, but that would be about as popular as meat-flavored ice cream.

And yes, this has already been posted to the Template mailing list :)

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.


In reply to Which template failed to load? by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.