Skip Menu |

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

Report information
The Basics
Id: 49481
Status: resolved
Priority: 0/
Queue: Template-Toolkit

People
Owner: Nobody in particular
Requestors: mkanat [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.22
Fixed in: (no value)



Subject: List VMethods (sometimes?) not called when argument is a variable
We have a custom vmethod called "contains". It's implemented like this: $Template::Stash::LIST_OPS->{ contains } = sub { my ($list, $item) = @_; return grep($_ eq $item, @$list) ? 1 : 0; }; I have a constant called ITA_FIELDS, which is an arrayref of strings. In the following testcase, contains() is never called (tested by putting a "die" in the function): [% SET this_var = 'a string' %] [% constants.ITA_FIELDS.contains(this_var) %] In the following testcase, contains() *is* called: [% constants.ITA_FIELDS.contains('a string') %]
Ticket migrated to github as https://github.com/abw/Template2/issues/86