NAME

WWW::Contact - Get contacts/addressbook from Web

SYNOPSIS

use WWW::Contact;

my $wc       = WWW::Contact->new();
my @contacts = $wc->get_contacts('fayland@gmail.com', 'password');
my $errstr   = $wc->errstr;
if ($errstr) {
    die $errstr; # like 'Wrong Password'
} else {
    print Dumper(\@contacts);
}

DESCRIPTION

Get Contacts/AddressBook from public websites.

SUPPORTED EMAIL SUPPLIER

Gmail
Yahoo! Mail

HOW TO WRITE MY OWN MODULE

please read WWW::Contact::Base and examples: WWW::Contact::Yahoo and WWW::Contact::Gmail

Assuming we write a custom module as WWW::Contact::Unknown

package WWW::Contact::Unknown;

use Moose;
extends 'WWW::Contact::Base';

sub get_contacts {
    my ($self, $email, $password) = @_;
    
    # reset
    $self->errstr(undef);
    
    if ($email eq 'a@a.com' and $password ne 'a') {
        $self->errstr('Wrong Password');
        return;
    }
    
    my @contacts = ( {
        email => 'b@b.com',
        name => 'b',
    }, {
        email => 'c@c.com',
        name => 'c'
    } );
    return wantarray ? @contacts : \@contacts;
}

1;

We can use it within WWW::Contact

my $wc = new WWW::Contact;
$wc->supplier('Unknown'); # it will eval use WWW::Contact::Unknown when get_contacts

my @contacts = $wc->get_contacts('a@a.com', 'b');
my $errstr = $wc->errstr;

SEE ALSO

WWW::Contact::Gmail, WWW::Contact::Yahoo, WWW::Mechanize, Moose

AUTHOR

Fayland Lam, <fayland at gmail.com>

COPYRIGHT & LICENSE

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.