Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Palm::Addressbook to Sylpheed addressbook converter

by Beatnik (Parson)
on Dec 01, 2001 at 23:03 UTC ( #128897=sourcecode: print w/ replies, xml ) Need Help??

Category: E-Mail Programs
Author/Contact Info Hendrik Van Belleghem (beatnik -at- quickndirty -dot- org)
Description: This code converts a Palms Addressbook to Sylpheeds addressbook. It uses XML::Writer, Palm::Addressbook (and parent modules). Sylpheed is a GTK+ based, lightweight, and fast e-mail client.
See comments for more info.

use strict;
use Palm::Address;
use XML::Writer;
use IO;

# Yes, this is copyright by me.

# Palm::Address converter to Sylpheed's XML Format
# Format tested on Sylpheed 0.6.4
# See

# Yes, I do know Sylpheed can do this too but that feature failed to c
+ompile for me
# You need to edit addrbook--index.xml so it has an entry as shown bel
#    <book name="Palm" file="addrbook-000003.xml" />
# The bookname can be changed but you'll need to change the source too
# You need to rename/move the output to the .sylpheed directory in you
+r homedir

my $pdb = Palm::Address->new();
my $output = new IO::File(">output.xml");
my $writer = new XML::Writer(OUTPUT => $output,DATA_MODE=>1, DATA_INDE
# This is ok for me, tweak it !
# Change name here
my $id = int rand(300000);
# I have NO idea if the UID needs to be sequential but this works
foreach my $record (@{$pdb->{records}})
{ my $email_loc;
  for (1..5)
  { if ($record->{phoneLabel}{"phone$_"} eq "4")
    { $email_loc = $_; }
  # Find which Phone field is for E-Mail
  if ($record->{fields}{"phone$email_loc"} =~ /\@/)
  { $id++;
    "cn"=>$record->{fields}{firstName}." ".$record->{fields}{name});
    my (@addresses) = split (/\n/,$record->{fields}{"phone$email_loc"}
    foreach my $addr(@addresses)
    {  $id++;
    foreach my $key (keys %{$record->{fields}})
    { if ($key ne "name" && $key ne "firstName" && $key ne "phone$emai
+l_loc" && $key ne "note")
      { $id++;

Comment on Palm::Addressbook to Sylpheed addressbook converter
Download Code

Back to Code Catacombs

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://128897]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2015-11-28 10:46 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (741 votes), past polls