Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Google Contacts Data API in Perl

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 t
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Changes
Octocat-spinner-32 README.markdown
Octocat-spinner-32 dist.ini
README.markdown

WWW-Google-Contacts

Synopsis

A Perl interface to Google Contacts.

Usage

use WWW::Google::Contacts;

my $google = WWW::Google::Contacts->new(
    username => "your.username",
    password => "your.password",
    protocol => "https",
);

# Create a new contact
my $contact = $google->new_contact;
$contact->full_name("Emmett Brown");
$contact->name_prefix("Dr");
$contact->email('doctor@timetravel.org');
$contact->hobby("Time travel");
$contact->jot([ "Went back in time", "Went forward in time", "Became blacksmith" ]),
$contact->create;  # save it to the server

# Now search for the given name, and read the jots
my @contacts = $google->contacts->search({ given_name => "Emmett" });
foreach my $c ( @contacts ) {
    print "Got the following jots about the good doctor\n";
    foreach my $jot ( @{ $c->jot } ) {
        print "Jot: " . $jot->value . "\n";
    }
    print "And now he goes back to the future\n";
    $c->delete;
}

# Print the names of all groups
my $groups = $google->groups;
while ( my $group = $groups->next ) {
    print "Title = " . $group->title . "\n";
}

# Add the contact to existing group 'Movie stars' and to a new group 'Back to the future'
my $new_group = $google->new_group({ title => "Back to the future" });
$new_group->create;  # create on server

my @groups = $google->groups->search({ title => "Movie stars" });
my $movie_stars_group = shift @groups;

$contact->add_group_membership( $new_group );
$contact->add_group_membership( $movie_stars_group );
$contact->update;

Description

This module implements the the Google Contacts API version 3.0, allowing you to easily create, retrieve, update and delete contacts and contact groups you have in your Google account using Perl.

Something went wrong with that request. Please try again.