Skip Menu |

This queue is for tickets about the HTML-Template CPAN distribution.

Report information
The Basics
Id: 64797
Status: resolved
Priority: 0/
Queue: HTML-Template

People
Owner: Nobody in particular
Requestors: zdenek.styblik [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 0.04
  • 0.05
  • 0.051
  • 0.06
  • 0.9
  • 0.91
  • 0.95
  • 0.96
  • 1.0
  • 1.1
  • 1.2.1
  • 1.3
  • 1.4
  • 1.5
  • 1.6
  • 1.7
  • 1.8
  • 2.0
  • 2.1
  • 2.2
  • 2.3
  • 2.4
  • 2.5
  • 2.6
  • 2.7
  • 2.8
  • 2.9
Fixed in: (no value)



Subject: PATCH - don't die if INCLUDE file doesn't exist
Hello, this is a PATCH proposal in case included template doesn't exist. In such case, don't die, but use Carp::clunk to silently report such failure. Some text like: "Unable to include 'foo.tmpl'" or whatever you like could be also inserted. Make such behavior as optional(= make an option for it) would be useable. Reason for this patch is I'm including templates generated by application back-end and although improbably, it might just happen they are gone. However, this breaks whole web application in case you're using tree-like template hierarchy ~ index.tmpl which includes other .tmpl files based on conditions. What I also fail to understand is why HTML::Template tries to include everything even I put INCLUDE into IF. My point is IF condition isn't fulfilled, then don't include template. Don't even care about if it does or doesn't exist. However, this is not the case. It seems HTML::Template includes everything and every time and this means even nested includes up to N levels bellow. So, if template is missing at N-th level, your whole applications goes "belly up". Since there are so many bugs open, I'm not giving this a big chance to get implemented nor get any feed back at all. However, somebody else might find it useful. I do. I don't like my applications die just because of one file. I've also tried to catch it in application itself, however since this is site-wide issue, I won't. Take care, Zdenek
Subject: Template.pm.patch-include
Download Template.pm.patch-include
application/octet-stream 1.1k

Message body not shown because it is not plain text.

From: zdenek.styblik [...] gmail.com
On Sat Jan 15 03:42:55 2011, stybla wrote: Show quoted text
> [...]
Just to show how to replicate what I'm talking about: ~~~ template1.tmpl ~~~ <someHtml> <TMPL_IF NAME="FOO"><TMPL_INCLUDE FILE="template2.tmpl"></TMPL_IF> </someHtml> ~~~ This is a bit extreme example including IF for showing included template. ~~~ template2.tmpl ~~~ <TMPL_INCLUDE NAME="doesntExist.tmpl"> ~~~ This is going to crash your application no matter if param 'FOO' is set or not, thus if 'template2.tmpl' gets included or not. I don't like such behavior and patch is attached to original message if anybody gets interested.
I've implemented a variation on this idea in the new upcoming 2.10 release which has a new option "die_on_missing_include". It defaults to true to keep the current (and what most people want) behavior, but can be set to false if you want it to be ignored.