Created
December 24, 2019 17:56
-
-
Save atoomic/b285d2d4145260aaeafacd51aeb8a198 to your computer and use it in GitHub Desktop.
Net::Google::Drive::Simple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!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