Re: Can a template tell if it has been PROCESSed or INCLUDEd?

Chad Wallace <[email protected]> Thu, 25 Sep 2014 11:13:55 -0700
Newsgroups gmane.comp.lang.perl.modules.template-toolkit
Organization The Lodging Company
Message-ID <[email protected]>
On Thu, 25 Sep 2014 12:35:20 -0500
Andy Lester <andy-U7RegYgSe6NWk0Htik3J/[email protected]> wrote:

> However, that does give me an idea.  Perhaps if I look for an
> app-wide global variable that should always exist, and it's not
> there, then I've been INCLUDEd correctly.

This won't work.  That variable will be there in an INCLUDE as well,
because, "The 'INCLUDE' directive localises (i.e. copies) all variables
before processing the template."[1]  It doesn't give you a clean slate.

[1]
http://template-toolkit.org/docs/manual/Directives.html#section_INCLUDE


-- 

C. Chad Wallace, B.Sc.
The Lodging Company
http://www.lodgingcompany.com/
OpenPGP Public Key ID: 0x262208A0