fractureMech,
Ok - I don't own a Palm Pilot, but I think this will work. With statements from the POD like "I don't know what these are.", I have to agree with your assesment of the documentation. You might also want to take a look at pdbdump which comes with the p5-Palm-1.3.0 suite
#!/usr/bin/perl -w
use strict;
use Text::CSV;
use Palm::PDB;
use Palm::Address;
my $pdb = new Palm::PDB;
$pdb->Load("myfile.pdb") or die "Unable to attach to address book";
my $csv = Text::CSV->new();
my @order = qw(
name firstName company phone1 phone2
phone3 phone4 phone5 address city
state zipCode country title custom1
custom2 custom3 custom4 note
);
open (OUTPUT, ">address.csv") or die "Unable to open output file : $!"
+;
select OUTPUT;
for my $record (@{$pdb->{records}}) {
my @output;
for my $field (@order) {
if (exists $record->{fields}{$field}) {
push @output, $record->{fields}{$field};
}
else {
push @output, '';
}
}
if ($csv->combine(@output)) {
my $string = $csv->string;
print $string, "\n";
}
else {
my $err = $csv->error_input;
print STDOUT "combine() failed on argument: ", $err, "\n";
}
}
Cheers and I hope it helps - L~R |