line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2009-2018 by [Mark Overmeer]. |
2
|
|
|
|
|
|
|
# For other contributors see ChangeLog. |
3
|
|
|
|
|
|
|
# See the manual pages for details on the licensing terms. |
4
|
|
|
|
|
|
|
# Pod stripped from pm file by OODoc 2.02. |
5
|
|
|
|
|
|
|
# This code is part of distribution Net-FTPSSL-Robust. Meta-POD processed |
6
|
|
|
|
|
|
|
# with OODoc into POD and HTML manual-pages. See README.md |
7
|
|
|
|
|
|
|
# Copyright Mark Overmeer. Licensed under the same terms as Perl itself. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Net::FTPSSL::Robust; |
10
|
1
|
|
|
1
|
|
169304
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
48
|
|
11
|
|
|
|
|
|
|
$VERSION = '0.06'; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
5
|
use base 'Net::FTP::Robust', 'Exporter'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
131
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
16
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
48
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our @EXPORT = qw/SECURITY_TLS SECURITY_SSL/; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
6
|
use Log::Report 'net-ftpssl-robust', syntax => 'SHORT'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
1160
|
use Net::FTPSSL; |
|
1
|
|
|
|
|
25702
|
|
|
1
|
|
|
|
|
74
|
|
23
|
|
|
|
|
|
|
# Gladly, ::FTPSSL has some level of interface compatibility with Net::FTP |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use constant |
26
|
1
|
|
|
|
|
230
|
{ SECURITY_TLS => 'TLS' |
27
|
|
|
|
|
|
|
, SECURITY_SSL => 'SSL' |
28
|
1
|
|
|
1
|
|
7
|
}; |
|
1
|
|
|
|
|
3
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub init($) |
32
|
0
|
|
|
0
|
0
|
|
{ my ($self, $args) = @_; |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
if(my $sec = delete $args->{Security}) |
35
|
|
|
|
|
|
|
{ $args->{useSSL} = |
36
|
0
|
0
|
|
|
|
|
$sec eq SECURITY_TLS ? 0 |
|
|
0
|
|
|
|
|
|
37
|
|
|
|
|
|
|
: $sec eq SECURITY_SSL ? 1 |
38
|
|
|
|
|
|
|
: error "unknown security protocol {proto}", proto => $sec; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
$self->SUPER::init($args); |
42
|
0
|
|
|
|
|
|
$self; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _connect($) |
47
|
0
|
|
|
0
|
|
|
{ my ($self, $opts) = @_; |
48
|
|
|
|
|
|
|
my $host = $opts->{Host} |
49
|
0
|
0
|
|
|
|
|
or error "no host provided to connect to"; |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my $ftp = Net::FTPSSL->new($host, %$opts); |
52
|
0
|
0
|
|
|
|
|
my $err = defined $ftp ? undef : $Net::FTPSSL::ERRSTR; |
53
|
0
|
|
|
|
|
|
($ftp, $err); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub _modif_time($$) |
57
|
0
|
|
|
0
|
|
|
{ my ($self, $ftp, $fn) = @_; |
58
|
0
|
|
|
|
|
|
$ftp->_mdtm($fn); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
0
|
|
|
sub _ls($) { $_[1]->nlst } |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
0
|
|
|
sub _can_restart($$$) { 1 } |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |