[Templates] [bug] string evaluated in the numeric context
Craig Barratt
craig@arraycomm.com
Mon, 23 Apr 2001 11:39:02 -0700
> Yes, it looks like a bug. An if statement in Parser.pm is missing
> a "length". Here's a patch.
Oops, I jumped too soon. Here's an improved patch that passes the
test suite (on some tests the original patch gives an error "Use of
uninitialized value in length at...")
Craig
*** Parser.pm Mon Apr 23 11:34:35 2001
--- Parser.pm.orig Fri Apr 6 04:04:58 2001
***************
*** 383,389 ****
($pre, $var, $dir) = ($1, $3 || $4, $2);
# preceding text
! if (defined($pre) && length($pre)) {
$line += $pre =~ tr/\n//;
$pre =~ s/\\\$/\$/g;
push(@tokens, 'TEXT', $pre);
--- 383,389 ----
($pre, $var, $dir) = ($1, $3 || $4, $2);
# preceding text
! if ($pre) {
$line += $pre =~ tr/\n//;
$pre =~ s/\\\$/\$/g;
push(@tokens, 'TEXT', $pre);