AnyEvent/FTP/Client/Role/ListTransfer.pm

filter: Statementstmt 88.5% 31 / 35 Branchbran 25.0% 1 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 91.6% 11 / 12 Podpod 0.0% 0 / 3 totaltotal 79.6% 43 / 54 SCAR 11.2
CC
3
Cov
82%
__ANON__
6.0
__ANON__
2.0
push_command
1.1
CRAP 3.1
« AnyEvent/FTP/Role/Event.pm ↑ Summary AnyEvent/FTP/Server/Role/Type.pm »
1 package AnyEvent::FTP::Client::Role::ListTransfer;
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 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 24 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # ABSTRACT: Fetch transfer interface for AnyEvent::FTP objects
9 24 our $VERSION = '0.19'; # VERSION
10  
11 sub xfer
12 {
13 24 ▶ my($self, $fh, $local) = @_;
Subroutine xfer: called CC=1 SCAR=0.0
Pod undocumented
14  
15 24 my $handle = $self->handle($fh);
16  
17 $handle->on_read(sub {
18 $handle->push_read(line => sub {
19 58 ▶ my($handle, $line) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
20 58 $line =~ s/\015?\012//g;
21 58 push @{ $local }, $line;
22 58 ▶ });
Subroutine __ANON__: called CC=1 SCAR=0.0
23 24 });
24 }
25  
26 sub convert_local
27 {
28 24 ▶ my($self, $local) = @_;
Subroutine convert_local: called CC=1 SCAR=0.0
Pod undocumented
29 24 return $local;
30 }
31  
32 sub push_command
33 {
34 24 ▶ my $self = shift;
Subroutine push_command: called CC=1 SCAR=0.8
Pod undocumented
35 my $cv = $self->{client}->push_command(
36 24 @_,
37 );
38  
39 $cv->cb(sub {
40 0 ▶ eval { $cv->recv };
Subroutine __ANON__: not called CC=2 SCAR=17.9
41 0 my $err = $@;
42 0 ▶ $self->{cv}->croak($err) if $err;
Branch: 1 branch
BranchTrueFalseTotal
if $err 0 0 0
43 24 });
44  
45 $self->on_eof(sub {
46 $cv->cb(sub {
47 24 ▶ my $res = eval { $cv->recv };
Subroutine __ANON__: called CC=2 SCAR=7.1
48 24 ▶ $self->{cv}->send($res) unless $@;
Branch: 1 branch
BranchTrueFalseTotal
unless $@ 24 0 24
49 24 ▶ });
Subroutine __ANON__: called CC=1 SCAR=0.0
50 24 });
51 }
52  
53 24 1;
54  
55 __END__
« AnyEvent/FTP/Role/Event.pm ↑ Summary AnyEvent/FTP/Server/Role/Type.pm »