Changeset 20390
- Timestamp:
- 2009-08-25T14:43:41+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/cfgread.pm
r18441 r20390 44 44 if ($line =~ m/^([\"\'])/ || $line =~ m/[^\\]([\"\'])/) { 45 45 my $quote=$1; 46 while ($line !~ m/$quote(.*?[^\\])?(\\\\)*$quote/) { 47 my $nextline = <$handle>; 48 if (defined($nextline)) { 46 47 # Improve speed substantially by not doing the regular expression on $line in the while loop 48 # (since $line gets longer each iteration, the regular expression gets slower and slower) 49 # Instead we just check each new line to see if it finishes the quoted multi-line value 50 if ($line !~ m/$quote(.*?[^\\])?(\\\\)*$quote/) 51 { 52 my $nextline; 53 while (defined($nextline = <$handle>)) 54 { 49 55 $nextline =~ s/\r?\n//; # remove end-of-line 50 56 $line .= " " . $nextline; 51 } else { 52 return undef; # parse error? 57 58 # Break out of the while loop if we've found the end of the multi-line value 59 last if ($nextline =~ m/^(.*?[^\\])?(\\\\)*$quote/); 53 60 } 54 61 }
Note:
See TracChangeset
for help on using the changeset viewer.