Skip to content

Instantly share code, notes, and snippets.

@atoomic
Created December 24, 2019 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atoomic/b285d2d4145260aaeafacd51aeb8a198 to your computer and use it in GitHub Desktop.
Save atoomic/b285d2d4145260aaeafacd51aeb8a198 to your computer and use it in GitHub Desktop.
Net::Google::Drive::Simple
#!perl
use strict;
use warnings;
use feature 'say';
use Net::Google::Drive::Simple;
my $gd = Net::Google::Drive::Simple->new();
my $children = $gd->children( "/" ) or die "Google::Drive failure: $!";
foreach my $child ( @$children ) {
# mimeType allow to know if it s a folder or not
#say( $child->mimeType, " -> ", $child->title() );
if ( $child->mimeType eq 'application/vnd.google-apps.folder' ) {
say "** ", $child->title, " is a folder";
} else {
say $child->title, " is a file";
}
}
__END__
# note the future release will contain some helpers
# so you could do something like this
foreach my $child ( @$children ) {
if ( $child->is_folder ) {
say "** ", $child->title, " is a folder";
} else {
say $child->title, " is a file";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment