ggdrv/upload5.pm untested

filter: Statementstmt 0.0% 0 / 35 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 57 CC 3 SCAR 16.1
CC
3
Cov
0%
upload5
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 5.0
1 package App::ggdrv::upload5 ;
2 use strict ;
3 use warnings ;
4 use feature qw [ say ] ;
5 use FindBin qw [ $Bin ] ;
6 use Getopt::Std ;
7 use Cwd ;
8 use Carp ;
9 return 1 ;
10  
11 sub upload5 {
12 getopts 'm:n', \my %o ;
13 $o{m} //= 'text/plain' ;
14 $ARGV[1] //= '.' ; # ローカルのディレクトリ名。
15 my $cwd = getcwd ;
16 chdir $ARGV[1] or die ;
17 my @files = grep { -f } <*> ; # ディレクトリは対象外となる。
18 my $out = '' ; #
19 #print qx[ $FindBin::Bin/upload11.pl -m $o{m} -f $ARGV[0] $_ ] for @files ;
20 do { print qx [ $0 upload -20 -m $o{m} -f $ARGV[0] $_ ] for @files } if ! $o{n} ;
21 do { say qq [ $0 upload -20 -m $o{m} -f $ARGV[0] $_ ] for @files } if $o{n} ;
22 chdir $cwd ;
23 }
24  
25  
26 =encoding utf8
27  
28 =head1
29  
30 ggdrive updoad5 FOLDER_ID LOCAL_DIR > VAR_FILE
31  
32 FOLDER_ID : GoogleドライブのフォルダーのID (33文字)
33 LOCAL_DIR : ローカルのディレクトリ。そこの直下にある通常ファイルが全てアップロードされる。未指定だと . (現行ディレクトリ)。
34 VAR_FILE : 5列のTSV形式ファイルとなる。各行は「HTTPステータスコード 新規のファイルID ファイル名 MIMETYPE "drive#file"」
35  
36 約1.5秒ごとに1ファイルアップロードするであろう(sleepではない。グーグルドライブ側でそれだけの時間がかかる)。
37  
38 オプション :
39  
40 -m MIMETYPE : MIMEタイプを指定する。
41 -n : ドライランになる。単に実行するコマンドを出力する。
42  
43  
44 =cut