App-Netsync
view release on metacpan or search on metacpan
lib/App/Netsync.pm view on Meta::CPAN
$db->disconnect;
},
'default' => sub { # Read a CSV file specified with the database option (-d).
open (my $db,'<',$data_source);
my $parser = Text::CSV->new;
chomp (my @fields = split (',',<$db>));
$parser->column_names(@fields);
# Filter out fields that are not needed,
# and verify the presence of necessary fields.
my $removed_field_count = 0;
foreach my $i (keys @fields) {
$i -= $removed_field_count;
unless ($fields =~ /(^|,)$fields[$i](,|$)/) {
++$removed_field_count;
splice (@fields,$i,1);
}
}
die 'incompatible database' unless @fields == scalar split (',',$fields);
( run in 0.626 second using v1.01-cache-2.11-cpan-13bb782fe5a )