Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc: srezic [...] iconmobile.com
AdminCc:

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



Subject: Warnings with replace() vmethod
This TT2 template is generating warnings: $ tpage [% SET bla = "foo"; bla.replace("(doesnotmatch)?(foo)", '$1$2'); %] (CTRL-D) Use of uninitialized value in subtraction (-) at /usr/lib/perl5/Template/VMethods.pm line 221. Use of uninitialized value in subtraction (-) at /usr/lib/perl5/Template/VMethods.pm line 221. Use of uninitialized value in substr at /usr/lib/perl5/Template/VMethods.pm line 221. The existence of a warning is somehow consistent with an equivalent perl program: use warnings; my $bla = "foo"; $bla =~ s{(doesnotmatch)?(foo)}{$1$2}; __END__ Use of uninitialized value $1 in concatenation (.) or string at ttreplaceprob2.pl line 16. But the difference here is that a perl programmer may choose to say "no warnings" here, or make use of the /e option and check the defined-ness in the right-hand side. The TT2 programmer cannot cease the warnings. Regards, Slaven
Here's a patch to cease the warnings: https://github.com/abw/Template2/pull/9 Regards, Slaven
Path applied, many thanks.