in reply to examples using Palm::Addressbook?
#!/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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: examples using Palm::Addressbook?
by fractureMech (Initiate) on Sep 08, 2003 at 01:48 UTC | |
by Limbic~Region (Chancellor) on Sep 08, 2003 at 01:53 UTC | |
by fractureMech (Initiate) on Sep 08, 2003 at 02:51 UTC |