AnyEvent/FTP/Client/Transfer/Passive.pm

filter: Statementstmt 96.0% 49 / 51 Branchbran 62.5% 5 / 8 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 12 / 12 Podpod 0.0% 0 / 1 totaltotal 82.9% 68 / 82 SCAR 19.6
CC
7
Cov
86%
__ANON__
4.7
__ANON__
2.1
__ANON__
2.1
CRAP 7.1
« AnyEvent/FTP/Client/Role/StoreTransfer.pm ↑ Summary AnyEvent/FTP/Server/Role/Auth.pm »
1 package AnyEvent::FTP::Client::Transfer::Passive;
2  
3 24 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 24 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 24 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 24 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 24 ▶use AnyEvent::Socket qw( tcp_connect );
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 24 extends 'AnyEvent::FTP::Client::Transfer';
10  
11 # ABSTRACT: Passive transfer class for asynchronous ftp client
12 24 our $VERSION = '0.19'; # VERSION
13  
14 sub BUILD
15 {
16 41 ▶ my($self) = @_;
Subroutine BUILD: called CC=2 SCAR=7.3
Pod undocumented
17  
18 41 my $local = $self->convert_local($self->local);
19  
20 my $data_connection = sub {
21 41 ▶ my $res = shift;
Subroutine __ANON__: called CC=4 SCAR=15.4
22 41 ▶ return if $res->is_preliminary;
Branch: 1 branch
BranchTrueFalseTotal
if $res->is_preliminary 0 41 41
23 41 my($ip, $port) = $res->get_address_and_port;
24 41 ▶ if(defined $ip && defined $port)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ip and defined $port) { } 41 0 41
Condition33%1/3
defined $ip and defined $port
!ll&&!rl&&r
0041
MC/DC0%0/2
defined $ip and defined $port
defined $ip defined $port
Truth table33%1/3
A and B
A= defined $ipB= defined $port
ABresult
0X0
100
111
25 {
26 tcp_connect $ip, $port, sub {
27 41 ▶ my($fh) = @_;
Subroutine __ANON__: called CC=2 SCAR=7.6
28 41 ▶ unless($fh)
Branch: 1 branch
BranchTrueFalseTotal
unless ($fh) 0 41 41
29 {
30 0 return "unable to connect to data port: $!";
31 }
32  
33 41 $self->xfer($fh,$local);
34 41 };
35 41 return;
36 }
37 else
38 {
39 0 $res;
40 }
41 41 };
42  
43 41 ▶ $self->push_command(
Branch: 1 branch
BranchTrueFalseTotal
$self->restart > 0 ? : 2 39 41
44 [ 'PASV', undef, $data_connection ],
45 ($self->restart > 0 ? ([ REST => $self->restart ]) : ()),
46 $self->command,
47 );
48  
49 $self->cv->cb(sub {
50 26 ▶ my $res = eval { shift->recv } // $@;
Subroutine __ANON__: called CC=2 SCAR=7.6
Condition33%1/3
eval { do { (shift())->recv } } // $@
l!l&&r!l&&!r
2600
MC/DC0%0/2
eval { do { (shift())->recv } } // $@
eval { do { (shift())->recv } } $@
Truth table33%1/3
A // B
A= eval { do { (shift())->recv } }B= $@
ABresult
1X1
011
000
51 26 $self->emit('close' => $res);
52 41 });
53 }
54  
55 package AnyEvent::FTP::Client::Transfer::Passive::Fetch;
56  
57 24 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
58 24 extends 'AnyEvent::FTP::Client::Transfer::Passive';
59  
60 24 with 'AnyEvent::FTP::Client::Role::FetchTransfer';
61  
62 package AnyEvent::FTP::Client::Transfer::Passive::Store;
63  
64 24 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
65 24 extends 'AnyEvent::FTP::Client::Transfer::Passive';
66  
67 24 with 'AnyEvent::FTP::Client::Role::StoreTransfer';
68  
69 package AnyEvent::FTP::Client::Transfer::Passive::List;
70  
71 24 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
72 24 extends 'AnyEvent::FTP::Client::Transfer::Passive';
73  
74 24 with 'AnyEvent::FTP::Client::Role::ListTransfer';
75  
76 24 1;
77  
78 __END__
« AnyEvent/FTP/Client/Role/StoreTransfer.pm ↑ Summary AnyEvent/FTP/Server/Role/Auth.pm »