Subject: | FIX: extract_multiple returns garbage unknown when a prefix has length and there are no unknown characters |
Attached is a fix to 1.95. If an extractor is used, there are no unknown characters, and a prefix is pulled, the unknown contents are incorrectly evaluated. The $unkpos indicates the start of the unknown region. The bug is that this is set to the current position (after the extractor match) and then the clause in "$lastpos-$unkpos" ends up being negative which leads to unexpected results. The correct behavior (attached) is to set $unkpos to $lastpos.
PERL VERSION:
This is perl, v5.8.6 built for MSWin32-x86-multi-thread
(with 3 registered patches, see perl -V for more detail)
Copyright 1987-2004, Larry Wall
Binary build 811 provided by ActiveState Corp. http://www.ActiveState.com
ActiveState is a division of Sophos.
Built Dec 13 2004 09:52:01
*** Balanced.pm.orig Thu Dec 22 17:41:22 2005
--- Balanced.pm Tue Dec 27 15:34:30 2005
***************
*** 930,936 ****
if (defined($field) && length($field))
{
if (!$igunk) {
! $unkpos = pos $$textref
if length($pref) && !defined($unkpos);
if (defined $unkpos)
{
--- 930,936 ----
if (defined($field) && length($field))
{
if (!$igunk) {
! $unkpos = $lastpos
if length($pref) && !defined($unkpos);
if (defined $unkpos)
{