Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Jemplate CPAN distribution.

Report information
The Basics
Id: 53453
Status: resolved
Priority: 0/
Queue: Jemplate

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

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



Subject: array VMETHOD 'slice' does not work as expected
Date: Thu, 07 Jan 2010 00:19:32 +0100
To: bug-Jemplate [...] rt.cpan.org
From: Gernot Kieseritzky <gernotk [...] gmail.com>
Jemplate (0.23) implements slice(#from, #to) using the JavaScript function slice(#from, #to) which unlike Perl's array slice operator does not include the element with index #to: [% test = [1,2,3] %] [% slice = test.slice(0,2) %] [% slice.join(',') %] --> 1,2 while in Perl-TT we obtain: --> 1,2,3 Since one advantage of Jemplate is to re-use server templates on the client side the calling conventions for all VMETHODS should be the same, shouldn't they?
I agree, I think the inconsistency is bad. TT's slice is more versatile anyhow, you couldn't do .slice( -3, -1 ) in previous versions of Jemplate. Fixed with test case; thanks for the report.