line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::uFTP; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
731
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
69
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
$VERSION = 0.161; |
6
|
|
|
|
|
|
|
#-------------- |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
9
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
31
|
|
10
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
113
|
|
11
|
1
|
|
|
1
|
|
1009
|
use UNIVERSAL::require; |
|
1
|
|
|
|
|
11463
|
|
|
1
|
|
|
|
|
13
|
|
12
|
1
|
|
|
1
|
|
44
|
use base qw(Class::Accessor::Fast::XS); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1718
|
|
13
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
14
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw(object host type user password debug port)); |
15
|
|
|
|
|
|
|
#====================================================================== |
16
|
|
|
|
|
|
|
sub new { |
17
|
0
|
|
|
0
|
1
|
|
my ($self, $host, %params) = (shift, shift, @_); |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
$params{host} = $host; |
20
|
0
|
|
|
|
|
|
$self = bless \%params, $self; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# little standarization :-) |
23
|
0
|
|
0
|
|
|
|
$self->type($self->type() or 'Net::uFTP::FTP'); |
24
|
0
|
0
|
|
|
|
|
my $type = $self->type() =~ /^Net::uFTP/o ? $self->type() : 'Net::uFTP::'.$self->type(); |
25
|
0
|
|
|
|
|
|
$type =~ s/SCP$/SFTP/; |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
$type->require or return; |
28
|
0
|
|
|
|
|
|
$self->type($type); |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
return $self; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
#====================================================================== |
33
|
|
|
|
|
|
|
sub get { |
34
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
35
|
0
|
|
|
|
|
|
return $self->object()->get(@_); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
#====================================================================== |
38
|
|
|
|
|
|
|
sub login { |
39
|
0
|
|
|
0
|
1
|
|
my ($self, $user, $passwd) = @_; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
my $type = $self->type(); |
42
|
0
|
|
|
|
|
|
$self->object($type->new($self->host, port => $self->port, user => $user, password => $passwd, debug => $self->debug)); |
43
|
0
|
0
|
|
|
|
|
return 1 if $self->object; |
44
|
0
|
|
|
|
|
|
return; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
#====================================================================== |
47
|
|
|
|
|
|
|
sub AUTOLOAD { |
48
|
0
|
|
|
0
|
|
|
our $AUTOLOAD; |
49
|
0
|
|
|
|
|
|
my ($method) = $AUTOLOAD =~ /::([^:]+)$/o; |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
return if $method eq 'DESTROY'; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
my $self = shift; |
54
|
0
|
0
|
|
|
|
|
croak(qq/Unsupported method "$method"/) unless $self->object()->can($method); |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return $self->object()->$method(@_); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
#====================================================================== |
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |