blib/lib/File/Slurp/Remote.pm

filter: Statementstmt 100% 31 / 31 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 95.5% 43 / 45 CC 4 SCAR 6.5
CC
4
Cov
95%
write_remote_file
3.1
read_remote_file
2.0
BEGIN
1.0
CRAP 1.9
« blib/lib/Tie/Function/Examples.pm ↑ Summary
1 package File::Slurp::Remote;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use File::Slurp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 require Exporter;
7 3 ▶use File::Slurp::Remote::SmartOpen;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 our @ISA = qw(Exporter);
10 3 our @EXPORT = (@File::Slurp::EXPORT, qw(write_remote_file read_remote_file));
11  
12 3 our $VERSION = '0.48';
13  
14 # Unused: retained so that code which sets it doesn't break
15 3 our $scp = "scp -q -o StrictHostKeyChecking=no -o BatchMode=yes -o PasswordAuthentication=no";
16  
17 sub write_remote_file
18 2 ▶{
Subroutine write_remote_file: called CC=3 SCAR=11.2
Pod documented
19 2 my $host = shift;
20 2 my $file = shift;
21  
22 2 my $fd;
23 2 smartopen("$host:$file", $fd, "w");
24 2 ▶ (print $fd @_) or die "write to $host:$file: $!";
Branch: 1 branch
BranchTrueFalseTotal
print $fd @_ or die "write to ${host}:${file}: $!" 2 0 2
25 2 ▶ close($fd) or die "close $host:$file: $!";
Branch: 1 branch
BranchTrueFalseTotal
close $fd or die "close ${host}:${file}: $!" 2 0 2
26 }
27  
28 sub read_remote_file
29 10 ▶{
Subroutine read_remote_file: called CC=2 SCAR=6.9
Pod documented
30 10 my $host = shift;
31 10 my $file = shift;
32  
33 10 my $fd;
34 10 smartopen("$host:$file", $fd, "r");
35 6 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) { } 1 5 6
36 1 return <$fd>;
37 } else {
38 5 return join('', <$fd>);
39 }
40 }
41  
42 3 1;
43  
44 __END__
« blib/lib/Tie/Function/Examples.pm ↑ Summary