nysus has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to find a module that will let me interface with gmail and gmail contacts. I tried WWW::Contact but it appears to no longer work. I've searched for other modules in cpan but can't find anything else. Any help finding a suitable module would be appreciated.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

Replies are listed 'Best First'.
Re: Perl module for gmail?
by tobyink (Canon) on Aug 03, 2018 at 13:12 UTC

    For contacts, you could try Moo::Google which is absolutely terribly named, but provides a low-level interface to cover all of Google's APIs, including People v1.

    If you also need to access emails, it does support the GMail API, but I'd probably use Mail::Box to connect via IMAP4 with TLS.

      That's a tad on the heavy side! Can anyone explain the rationale of Moo::Google having both Moo and Moose as dependencies?

      OK, so I got it set up but I'm stuck on how to call Google's api for People. I've tried various things along the lines of:

      my $ri = $gapi->People->get; my $ri = $gapi->People->listPeopleConnections; my $ri = $gapi->People->contactGroups->list->json; my $ri = $gapi->People->batchGet; ...etc...

      How do I figure out which methods to call?

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
      $nysus = $PM . ' ' . $MCF;
      Click here if you love Perl Monks

      Thanks, this looks like it could be the most comprehensive solution. It allows you to work with the JSON file that google gives you for a project.

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
      $nysus = $PM . ' ' . $MCF;
      Click here if you love Perl Monks

Re: Perl module for gmail?
by Corion (Patriarch) on Aug 03, 2018 at 13:11 UTC

    I haven't done this, but some quick googling suggests that you want to use the Google Contacts API, which references the Google Data API, which would be wrapped by API::Google.

    Have you tried that?

    Update:s/Google::API/API::Google/

      Do you mean API::Google? Google::API doesn't work as a link.

Re: Perl module for gmail?
by LanX (Saint) on Aug 03, 2018 at 13:14 UTC

      I saw that and looked at the synopsis for WWW::Contact::GoogleContactsAPI module and it's the same as for WWW::Contact which left me very confused. And that newer module passes the email and password to google which does not work anymore.

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest";
      $nysus = $PM . ' ' . $MCF;
      Click here if you love Perl Monks

Re: Perl module for gmail?
by localshop (Monk) on Nov 05, 2018 at 06:44 UTC
    There are quite a few old and broken CPAN modules. I was unable to get any of the previously mentioned modules to work.

    The state of the art is to use an OAUTH2 client to access the V1 Google Cloud API Services which includes GMail and Persons for the contacts list.

    I am working on refining the CPAN Module WebService::GoogleAPI::Client and I put together a working example of listing an authenticated users' contacts in the examples which you can access directly from the CPAN tarball or from the Github pscott-au/WebService-GoogleAPI-Client Repo

    More specifically - the examples that will work with version 0.18 are available at:

    I note that this package was originally forked from the mentioned Moo::Google as I thought this would be a good way to learn Moo/Mojo from an existing substantial implementation but I should note that the more I dug into the source the more strange and what look seriously flawed things I came across to the extent that most of the original intent of the module has been refactored out. There remain a few indications of my lack of Moo/Mojo good practice but the new code is serving me well and I'll continue to apply my learnings to clean it up.

    If there are any restless monks proficient in Moo and Mojo::UserAgent particularly in an OAUTH environment then I'd love some tips if anyone has time to skim the code.

    Many thanks and hope that this helps someone who wants to send/receive email or like me really wants to start digging into the Google Cloud API Services.