GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
WWW::Contact(3) User Contributed Perl Documentation WWW::Contact(3)

WWW::Contact - Get contacts/addressbook from Web

    use WWW::Contact;
    use Data::Dumper;
    # Get contacts from email providers.
    my $wc       = WWW::Contact->new();
    my @contacts = $wc->get_contacts('fayland@gmail.com', 'password');
    my $errstr   = $wc->errstr;
    if ($errstr) {
        die $errstr; # like 'Wrong Username or Password'
    } else {
        print Dumper(\@contacts);
    }
    # Get contacts from social networks (eg: Plaxo)
    my $ws       = WWW::Contact->new();
    # Note that the last argument for get_contacts() is mandatory,
    # or else it will try to fetch contacts from gmail.com
    my @contacts = $ws->get_contacts('itsa@gmail.com', 'password', 'plaxo');
    my $errstr   = $ws->errstr;
    if ($errstr) {
        die $errstr; # like 'Wrong Username or Password'
    } else {
        print Dumper(\@contacts);
    }

Get contacts/addressbook from public websites

WWW::Contact::Gmail by Fayland Lam, DEPRECATED for WWW::Contact::GoogleContactsAPI
WWW::Contact::Yahoo by Fayland Lam
WWW::Contact::Rediffmail by Sachin Sebastian
WWW::Contact::CN::163 by Fayland Lam
WWW::Contact::AOL by Fayland Lam
WWW::Contact::Mail by Sachin Sebastian
WWW::Contact::Hotmail by Fayland Lam
WWW::Contact::Indiatimes by Sachin Sebastian
WWW::Contact::Lycos by Sachin Sebastian
WWW::Contact::Plaxo by Sachin Sebastian
WWW::Contact::GoogleContactsAPI by Fayland Lam, using Google Contacts Data API
WWW::Contact::BG::Abv by Dimitar Petrov
WWW::Contact::BG::Mail by Dimitar Petrov

To use custom supplier, we must register within WWW::Contact

    $wc->register_supplier( qr/\@a\.com$/, 'Unknown' );
    $wc->register_supplier( 'a.com', 'Unknown' );

The first arg is a Regexp or domain from email postfix. The second arg is the according module postfix like 'Unknown' from WWW::Contact::Unknown

get supplier by email.

    my $supplier = $wc->get_supplier_by_email('a@gmail.com'); # 'GoogleContactsAPI'
    my $supplier = $wc->get_supplier_by_email('a@a.com');     # 'Unknown'

get supplier by social network name.

    my $supplier = $wc->get_supplier_by_socialnetwork('plaxo'); # 'Plaxo'

Please read WWW::Contact::Base and examples: WWW::Contact::Yahoo and WWW::Contact::Plaxo

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 Username or 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 = WWW::Contact->new();
    $wc->register_supplier( qr/\@a\.com$/, 'Unknown' );
    # or
    # $wc->register_supplier( 'a.com', 'Unknown' );
    my @contacts = $wc->get_contacts('a@a.com', 'b');
    my $errstr = $wc->errstr;

WWW::Mechanize, Moose

<http://github.com/fayland/perl-www-contact/tree/master>
<http://groups.google.com/group/perl-www-contact>

Fayland Lam, "<fayland at gmail.com>"

Sachin Sebastian, "<sachinjsk at cpan.org>"

Dimitar Petrov, "<mitakaa at gmail.com>"

Copyright 2008 *AUTHOR* all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2018-02-28 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.