6 use XBase; # or could use DBI and DBD::XBase;
13 GetOptions('in=s' => \$in, 'out=s' => \$out);
15 open OUT, ">$out" or die $!;
17 my $table = new XBase $in or die XBase->errstr;
19 # get list of field names
20 my @names = $table->field_names;
22 # dump PATRONID, SURNAME, FIRSTNAME
23 print OUT join ("\t", @names) . "\n";
31 Encode::encode("utf8", $_)
32 } else { ''; } # to avoid 'Use of uninitialized value in join'
36 for (0 .. $table->last_record) {
38 my ($deleted, @row) = $table->get_record($_);
39 @row = map (&clean, @row);
40 print OUT join("\t", @row) . "\n" unless $deleted;
44 print STDERR "$i records exported to $out.\n";