mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2026-02-20 11:15:23 +00:00
[svn r8003] fix fucking qm script AGAIN
This commit is contained in:
@@ -92,7 +92,8 @@ while (<CSV>) {
|
||||
if (!$ref) { $ref = ""; }
|
||||
if (!$grade) { $grade = ""; }
|
||||
if (!$desc) { $desc = ""; }
|
||||
# hacked in by DL, as was acting weirdly due to uninitialized variables
|
||||
if (!$area) { $area = ""; }
|
||||
print "number $number, grade $grade, area $area, desc $desc, ref $ref, station $station, completion $completion\n";
|
||||
|
||||
if (($completion ne "") and ($ref ne ""))
|
||||
{
|
||||
@@ -177,25 +178,13 @@ print "\nInformation: Done\n";
|
||||
|
||||
# Parse the CSV file
|
||||
sub parse_csv {
|
||||
my $line = $_[0];
|
||||
my @parsedline = ();
|
||||
my $field = '';
|
||||
|
||||
while ($line =~ m{ \G(?:^|,)
|
||||
(?: "((?> [^"]*) (?> "" [^"]*)*)" | ([^",]*)) }gx) {
|
||||
if ($2) {
|
||||
$field = $2;
|
||||
} elsif ($1) {
|
||||
$field = $1;
|
||||
$field =~ s/""/"/g;
|
||||
} else {
|
||||
$field = '';
|
||||
}
|
||||
|
||||
push(@parsedline, $field);
|
||||
my @fields=split /\t/;
|
||||
my @unquoted=();
|
||||
foreach $_ (@fields) {
|
||||
$_ =~ s/\"//g;
|
||||
push (@unquoted, $_);
|
||||
}
|
||||
|
||||
return(@parsedline);
|
||||
return @unquoted;
|
||||
}
|
||||
|
||||
# Usage
|
||||
|
||||
Reference in New Issue
Block a user