line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::Base::ModuleBuild::Repository::FTP; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
203105
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
104
|
|
4
|
4
|
|
|
4
|
|
16
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
93
|
|
5
|
4
|
|
|
4
|
|
389
|
use parent 'Alien::Base::ModuleBuild::Repository'; |
|
4
|
|
|
|
|
286
|
|
|
4
|
|
|
|
|
23
|
|
6
|
4
|
|
|
4
|
|
191
|
use Carp; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
170
|
|
7
|
4
|
|
|
4
|
|
3324
|
use Net::FTP; |
|
4
|
|
|
|
|
299528
|
|
|
4
|
|
|
|
|
1050
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: HTTP repository handler |
10
|
|
|
|
|
|
|
our $VERSION = '1.16_01'; # TRIAL VERSION |
11
|
|
|
|
|
|
|
$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval) |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
0
|
98
|
sub is_network_fetch { 1 } |
14
|
1
|
|
|
1
|
0
|
4
|
sub is_secure_fetch { 0 } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub connection { |
17
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
return $self->{connection} |
20
|
0
|
0
|
|
|
|
|
if $self->{connection}; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# allow easy use of Net::FTP subclass |
23
|
0
|
|
0
|
|
|
|
$self->{protocol_class} ||= 'Net::FTP'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
my $server = $self->{host} |
26
|
0
|
0
|
|
|
|
|
or croak "Must specify a host for FTP service"; |
27
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
my $ftp = $self->{protocol_class}->new($server, Debug => 0) |
29
|
|
|
|
|
|
|
or croak "Cannot connect to $server: $@"; |
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
$ftp->login() |
32
|
|
|
|
|
|
|
or croak "Cannot login ", $ftp->message; |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
if (defined $self->location) { |
35
|
0
|
0
|
|
|
|
|
$ftp->cwd($self->location) |
36
|
|
|
|
|
|
|
or croak "Cannot change working directory ", $ftp->message; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
$ftp->binary(); |
40
|
0
|
|
|
|
|
|
$self->{connection} = $ftp; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
return $ftp; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub get_file { |
46
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
47
|
0
|
|
0
|
|
|
|
my $file = shift || croak "Must specify file to download"; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my $ftp = $self->connection(); |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
$ftp->get( $file ) or croak "Download failed: " . $ftp->message(); |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
return $file; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub list_files { |
57
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
58
|
0
|
|
|
|
|
|
return $self->connection->ls(); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |