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