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