Changeset 3418 for trunk/gsdl/perllib


Ignore:
Timestamp:
2002-09-10T19:15:46+12:00 (22 years ago)
Author:
jrm21
Message:

Allow fields to stretch over multiple lines if enclosed in double quotes.
Eg

collectionmeta collectionextra "

foo
bar

"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/cfgread.pm

    r2772 r3418  
    3939    $line =~ s/\cM|\cJ//g; # remove end-of-line characters
    4040    $line =~ s/^\s+//;     # remove initial white space
     41    # Merge with following line if a quoted phrase is left un-closed.
     42    if ($line =~ m/[^\\]\"/) {
     43        while ($line !~ m/\"(.*?[^\\])?\"/) {
     44        my $nextline = <$handle>;
     45        if (defined($nextline)) {
     46            $nextline =~ s/\r?\n//; # remove end-of-line
     47            $line .= " " . $nextline;
     48        } else {
     49            return undef; # parse error?
     50        }
     51        }
     52    }
    4153    $linecontinues = $line =~ s/\\$//;
     54
    4255    while ($line =~ s/\s*(\"[^\"]*\"|\'[^\']*\'|\S+)\s*//) {
    4356        if (defined $1) {
Note: See TracChangeset for help on using the changeset viewer.