Skip Menu |

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

Maintainer(s)' notes

Note: there is a bug with caching and TMPL_INCLUDE_VAR since 0.97_004 until 0.98. either use an earlier version or upgrade to 0.98_001. Another workaround is to precompile all templates to file_cache_dir. The bug happens when including a template via INCLUDE_VAR and the template is not yet compiled or has changed.

I'm sorry if the change about aliases came quite unannounced. I didn't expect any problems since dollar signs are not allowed in template vars, but I heard from at least one case where people were doing exactly this.
Please do not use unallowed characters in template vars. Allowed are (from the HTML::Template::FAQ): Numbers, letters, '.', '/', '+', '-' and '_'.
This should work in HTML::Template::Compiled::Classic.
in HTML::Template::Compiled you should be only using numbers, letters and _.
The dot, for example, is special. If you need to get a hash key from the template parameters with special charcaters, you can try <tmpl_var _.$var$name$with$dollars >

There will be a workaround in the next version:
local $HTML::Template::Compiled::Compiler::DISABLE_NEW_ALIAS = 1;


Please report any bug you find.
The code is now hosted on https://github.com/perlpunk/HTML-Template-Compiled
If you have a bug report, you can also post it there in the "Issues" section.
In the bugreport, please include, if possible, the module version, perl version and a testcase that reproduces the error; that makes it easier to find the bug.

The issue with not reloading includes of includes should be fixed in version 0.95_003. If you have any problems though please report!

Using query() and the dot syntax might not work together always. If you have a tmpL_var name="..foo" (going up the stash one level) the var foo is not detected and will not be reported by the query() function. Since the dot syntax is for dereferencing hashes and method calls the query function might not make sense anyway. I believe it is a bad idea to let the program do things if the template is using a certain variable.

Thanks!

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

People
Owner: TINITA [...] cpan.org
Requestors: ac0v [...] sys-network.de
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.90
Fixed in: 0.92



Subject: Varstring lookup for object methods broken
Lookup for method calls via var strings are broken if you try to call an none existant method. This can happen if you get an object where you don't know the exact class type. If I try to catch this error in an conditional context, eg. an if (see Sample 2) it will also croak. I've attached a diff with a possible bugfix. Would be great if you can comment/fix this :) Sample 1: ---------------- $htc->param(hash_ref => { blessed => $object }); <%= hash_ref.blessed.any_none_existant_method %> Sample 2: ---------------- $htc->param(hash_ref => { blessed => $object }); <%IF hash_ref.blessed.any_none_existant_method %> this will also croak <%/IF%>
Subject: Compiler.pm.diff
252c252 < \$var = UNIVERSAL::can(\$var,'can') ? \$var->$p() : \$var->\{'$path'\}; --- > \$var = 'HASH' eq ref \$var ? \$var->\{'$path'\} : UNIVERSAL::can(\$var,'$p') ? \$var->$p() : undef; 295c295 < \$var = UNIVERSAL::can(\$var,'can') ? \$var->$p() : \$var->\{'$path'\}; --- > \$var = 'HASH' eq ref \$var ? \$var->\{'$path'\} : UNIVERSAL::can(\$var,'$p') ? \$var->$p() : undef;
From: cpan2 [...] tinita.de
On So. 18. Nov. 2007, 18:39:06, ACID wrote: Show quoted text
> UNIVERSAL::can(\$var,'$p')
this code has problems, unfortunately, which objects coming from DBIx::Class. The old code looked like this, but I had to change it because I wanted it to work with DBIx::Class. The reason is probably that I call UNIVERSAL::can('can'). To fix it, it would be necessary to find out if we have an object (with can('can") or Scalar::Util::blessed and then call $obj->can(). I'll try it out. thanks for the report, tina
From: TINITA [...] cpan.org
On So. 18. Nov. 2007, 18:39:06, ACID wrote: Show quoted text
> Lookup for method calls via var strings are broken if you try to call
an Show quoted text
> none existant method. This can happen if you get an object where you > don't know the exact class type. > If I try to catch this error in an conditional context, eg. an if (see > Sample 2) it will also croak.
i uploaded developer release 0.91_001 HTC has a new option 'objects' which can be set to 'nostrict'. nostrict means, don't be strict about non-existant methods, don't die, just return undef. it should behave like your patch does, although the code looks a bit different (i use Scalar::Util::blessed now) please tell me if you think this makes sense. regards, tina