line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Sky::Module; |
2
|
|
|
|
|
|
|
$App::Sky::Module::VERSION = '0.4.0'; |
3
|
2
|
|
|
2
|
|
85677
|
use strict; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
61
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
50
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
11
|
use Carp (); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
46
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
527
|
use Moo; |
|
2
|
|
|
|
|
11473
|
|
|
2
|
|
|
|
|
10
|
|
10
|
2
|
|
|
2
|
|
2211
|
use MooX 'late'; |
|
2
|
|
|
|
|
10015
|
|
|
2
|
|
|
|
|
10
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
26172
|
use URI; |
|
2
|
|
|
|
|
4540
|
|
|
2
|
|
|
|
|
120
|
|
13
|
2
|
|
|
2
|
|
13
|
use File::Basename qw(basename); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
139
|
|
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
1107
|
use List::MoreUtils qw( uniq ); |
|
2
|
|
|
|
|
24995
|
|
|
2
|
|
|
|
|
12
|
|
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
|
2978
|
use App::Sky::Results; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
87
|
|
18
|
2
|
|
|
2
|
|
850
|
use App::Sky::Exception; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
656
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has base_upload_cmd => ( isa => 'ArrayRef[Str]', is => 'ro', ); |
21
|
|
|
|
|
|
|
has dest_upload_prefix => ( isa => 'Str', is => 'ro', ); |
22
|
|
|
|
|
|
|
has dest_upload_url_prefix => ( isa => 'Str', is => 'ro', ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub get_upload_results |
26
|
|
|
|
|
|
|
{ |
27
|
11
|
|
|
11
|
1
|
22850
|
my ( $self, $args ) = @_; |
28
|
|
|
|
|
|
|
|
29
|
11
|
|
100
|
|
|
51
|
my $is_dir = ( $args->{is_dir} // 0 ); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $filenames = $args->{filenames} |
32
|
11
|
50
|
|
|
|
60
|
or Carp::confess("Missing argument 'filenames'"); |
33
|
|
|
|
|
|
|
|
34
|
11
|
50
|
|
|
|
30
|
if ( @$filenames != 1 ) |
35
|
|
|
|
|
|
|
{ |
36
|
0
|
|
|
|
|
0
|
Carp::confess("More than one file passed to 'filenames'"); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $target_dir = $args->{target_dir} |
40
|
11
|
50
|
|
|
|
27
|
or Carp::confess("Missing argument 'target_dir'"); |
41
|
|
|
|
|
|
|
|
42
|
11
|
|
|
|
|
47
|
my $invalid_chars_re = qr/[:]/; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my @invalid_chars = |
45
|
11
|
|
|
|
|
25
|
( map { split( //, $_ ) } map { /($invalid_chars_re)/g } @$filenames ); |
|
1
|
|
|
|
|
5
|
|
|
11
|
|
|
|
|
91
|
|
46
|
|
|
|
|
|
|
|
47
|
11
|
100
|
|
|
|
32
|
if (@invalid_chars) |
48
|
|
|
|
|
|
|
{ |
49
|
|
|
|
|
|
|
App::Sky::Exception::Upload::Filename::InvalidChars->throw( |
50
|
1
|
|
|
|
|
25
|
invalid_chars => [ sort { $a cmp $b } uniq(@invalid_chars) ], ); |
|
0
|
|
|
|
|
0
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
return App::Sky::Results->new( |
54
|
|
|
|
|
|
|
{ |
55
|
|
|
|
|
|
|
upload_cmd => [ |
56
|
10
|
100
|
|
|
|
16
|
@{ $self->base_upload_cmd() }, |
|
10
|
|
|
|
|
426
|
|
57
|
|
|
|
|
|
|
@$filenames, |
58
|
|
|
|
|
|
|
( $self->dest_upload_prefix() . $target_dir ), |
59
|
|
|
|
|
|
|
], |
60
|
|
|
|
|
|
|
urls => [ |
61
|
|
|
|
|
|
|
URI->new( |
62
|
|
|
|
|
|
|
$self->dest_upload_url_prefix() |
63
|
|
|
|
|
|
|
. $target_dir |
64
|
|
|
|
|
|
|
. basename( $filenames->[0] ) |
65
|
|
|
|
|
|
|
. ( $is_dir ? '/' : '' ) |
66
|
|
|
|
|
|
|
), |
67
|
|
|
|
|
|
|
], |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
__END__ |