The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::GoogleDrive - A Google Drive API interface

VERSION

Version 0.02

SYNOPSIS

Google Drive API is basd on OAuth. I try to abstract as much away as possible so you should not need to know too much about it. Kudos to Net::Dropbox::API.

This is how it works:

    use Net::GoogleDrive;

    my $gdrive = Net::GoogleDrive->new();
    my $login_link = $gdrive->login_link();

    ... Time passes and the login link is clicked ...

    my $gdrive = Net::GoogleDrive->new();

    # $code will come from CGI or somesuch: Google gives it to you
    $gdrive->token($code);

    my $files = $gdrive->files();

    foreach my $f (@{ $files->{items} }) {
        if ($f->{downloadUrl}) {
            open(my $fh, ">", "file.dl") or die("file.dl: $!\n");
            print($fh $gdrive->downloadUrl($f));
            close($fh);
        }
    }

FUNCTIONS

This returns the login URL. This URL has to be clicked by the user and the user then has to accept the application in Google Drive.

Google Drive then redirects back to the callback URI defined with $self->redirect_uri.

token

This returns the Google Drive access token. This is needed to authorize with the API.

files

This returns a files Resource object from JSON.

downloadUrl

This returns the binary data from a file.

FUTURE

More can be added if there is interest.

AUTHOR

Brian Medley, <bpmedley at cpan.org>

BUGS

There are plenty.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Net::GoogleDrive

COPYRIGHT & LICENSE

Copyright 2012 Brian Medley.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.