WWW::Contact::GoogleContactsAPI - Get contacts via Google Contacts Data API
use WWW::Contact; use Data::Dumper; my $wc = WWW::Contact->new(); my @contacts = $wc->get_contacts('itsa@gmail.com', 'password'); my $errstr = $wc->errstr; die $errstr if ($errstr); print Dumper(\@contacts);
WWW::Contact::GoogleContactsAPI uses the Google Contacts Data API (http://code.google.com/apis/contacts/docs/3.0/reference.html) to retrieve all a user's contacts.
$wc->get_contacts($email, $password)
Login to Google using email and password. Fetch all the given user's contacts. Return them as a list or, in a scalar context, as a reference to a list. Each element of the result represents one contact as a reference to a hash with one or more of the following keys (all fields are optional):
email
password
name
The contact's main name as a single string. This may be a person's full name or the name of an organisation.
family_name
A person's family name (surname or last name), usually shared with one or both parents.
given_name
A person's given name (christian name or first name).
nickname
An alternative name or alias for the contact.
emails
An ordered list of references to pairs, [$address, $type], where $type is "home", "work", "other" or some custom label and $address is the corresponding e-mail address.
[$address, $type]
$type
"home"
"work"
"other"
$address
The first address in emails, if any. Deprecated: use $contact->{emails}->[0][0].
$contact->{emails}->[0][0]
addresses
As for emails but $address is a postal addresses, given as a single string.
birthday
The date of birth in the form YYYY-MM-DD or --MM-DD.
YYYY-MM-DD
--MM-DD
age
The age in years today, calculated from the date of birth.
events
An ordered list of references to pairs, [$date, $type], where $date is the date of the event in the form YYYY-MM-DD and $type is the type of event, e.g. "anniversary".
[$date, $type]
$date
instant_messengers
An ordered list of references to pairs, [$protocol, $address], where $protocol is one of gtalk, jabber, msn, skype, yahoo and possibly others.
[$protocol, $address]
$protocol
gtalk
jabber
msn
skype
yahoo
phones
An ordered list of references to pairs, [$number, $type], where $type is one of home, work, mobile and possibly other values. $number may include punctuation and comments.
[$number, $type]
home
work
mobile
$number
updated
The time when this contact was last modified in the form YYYY-MM-DDTHH:MM:SS.SSSZ where T is a literal "T", SS.SSS is seconds and milliseconds as a decimal and Z indicates the UTC time-zone.
YYYY-MM-DDTHH:MM:SS.SSSZ
T
SS.SSS
Z
notes
Arbitrary text.
child
spouse
Relations are returned as references to lists of names (even mother and father).
organisations
An ordered list of reference to pairs, [$organisation, $type], where $organisation is a body this contact is associated with and $type is the type of relationship.
[$organisation, $type]
$organisation
groups
A reference to a list of group names
Any custom fields not recognised by the module are returned in the output hash with a simple string value.
WWW::Contact, WWW::Mechanize, Net::Google::AuthSub
Fayland Lam, <fayland at gmail.com> Denis Howe, denis.howe=gc@gmail.com
<fayland at gmail.com>
denis.howe=gc@gmail.com
Copyright 2008 Fayland Lam, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install WWW::Contact, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Contact
CPAN shell
perl -MCPAN -e shell install WWW::Contact
For more information on module installation, please visit the detailed CPAN module installation guide.