File/Slurp/Remote.pm

filter: Statementstmt 70.4% 31 / 44 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 8 / 10 Podpod n/a totaltotal 65.0% 39 / 60 CC 4 SCAR 14.6
CC
4
Cov
62%
write_remote_file
12.0
read_remote_file
6.0
BEGIN
1.0
CRAP 4.3
« File/Slurp/Remote/BrokenDNS.pm ↑ Summary File/Slurp/Remote/CanonicalHostnames.pm »
1  
2 1 ▶use File::Slurp::Remote;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use File::Slurp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 require Exporter;
8 1 ▶use File::Slurp::Remote::BrokenDNS qw($myfqdn %fqdnify);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Tie::Function::Examples qw(%q_shell);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use File::Slurp::Remote::SmartOpen;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use File::Temp qw(tempdir);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 our @ISA = qw(Exporter);
14 1 our @EXPORT = (@File::Slurp::EXPORT, qw(write_remote_file read_remote_file));
15  
16 1 our $VERSION = 0.42;
17  
18 1 my $tmpdir = tempdir(CLEANUP => 1);
19  
20 1 our $scp = "scp -q -o StrictHostKeyChecking=no -o BatchMode=yes -o PasswordAuthentication=no";
21  
22 sub write_remote_file
23 0 ▶{
Subroutine write_remote_file: not called CC=3 SCAR=24.8
24 0 my $host = shift;
25 0 my $file = shift;
26  
27 0 my $fd;
28 0 smartopen("$host:$file", $fd, "w");
29 0 ▶ (print $fd @_) or die "write to $host:$file: $!";
Branch: 1 branch
BranchTrueFalseTotal
print $fd @_ or die "write to ${host}:${file}: $!" 0 0 0
30 0 ▶ close($fd) or die "close $host:$file: $!";
Branch: 1 branch
BranchTrueFalseTotal
close $fd or die "close ${host}:${file}: $!" 0 0 0
31 }
32  
33 sub read_remote_file
34 0 ▶{
Subroutine read_remote_file: not called CC=2 SCAR=17.9
35 0 my $host = shift;
36 0 my $file = shift;
37  
38 0 my $fd;
39 0 smartopen("$host:$file", $fd, "r");
40 0 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 0 0 0
41 0 return <$fd>;
42 } else {
43 0 return join('', <$fd>);
44 }
45 }
46  
47 1 1;
48  
49 __END__
« File/Slurp/Remote/BrokenDNS.pm ↑ Summary File/Slurp/Remote/CanonicalHostnames.pm »