Brackup/DecryptedFile.pm

filter: Statementstmt 100% 25 / 25 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 2 totaltotal 75.0% 36 / 48 CC 5 SCAR 9.0
CC
5
Cov
83%
new
4.4
name
2.3
BEGIN
1.0
CRAP 2.5
« Brackup/Target/CloudFiles.pm ↑ Summary Brackup/CompositeChunk.pm »
1 package Brackup::DecryptedFile;
2  
3 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 13 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 13 ▶use Brackup::Decrypt;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 9 ▶sub new {
Subroutine new: called CC=4 SCAR=14.8
Pod undocumented
9 9 my ($class, %opts) = @_;
10 9 my $self = bless {}, $class;
11  
12 9 $self->{original_file} = delete $opts{filename}; # filename we're restoring from
13  
14 die "File $self->{original_file} does not exist"
15 9 ▶ unless $self->{original_file} && -f $self->{original_file};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"original_file"} and -f $self->{"original_file"} 0 9 9
Condition33%1/3
$self->{"original_file"} and -f $self->{"original_file"}
!ll&&!rl&&r
009
MC/DC0%0/2
$self->{"original_file"} and -f $self->{"original_file"}
$self->{"original_file"} -f $self->{"original_file"}
Truth table33%1/3
A and B
A= $self->{"original_file"}B= -f $self->{"original_file"}
ABresult
0X0
100
111
16 9 ▶ croak("Unknown options: " . join(', ', keys %opts)) if %opts;
Branch: 1 branch
BranchTrueFalseTotal
if %opts 0 9 9
17  
18 # decrypted_file might be undef if no decryption was needed.
19 9 $self->{decrypted_file} = Brackup::Decrypt::decrypt_file_if_needed($self->{original_file});
20  
21 9 return $self;
22 }
23  
24 9 ▶sub name {
Subroutine name: called CC=2 SCAR=8.1
Pod undocumented
25 9 my $self = shift;
26 9 ▶ return $self->{decrypted_file} || $self->{original_file};
Condition33%1/3
$self->{'decrypted_file'} || $self->{'original_file'}
l!l&&r!l&&!r
090
MC/DC0%0/2
$self->{'decrypted_file'} || $self->{'original_file'}
$self->{'decrypted_file'} $self->{'original_file'}
Truth table33%1/3
A || B
A= $self->{'decrypted_file'}B= $self->{'original_file'}
ABresult
1X1
011
000
27 }
28  
29 9 ▶sub DESTROY {
Subroutine DESTROY: called CC=1 SCAR=0.0
30 9 my $self = shift;
31 9 unlink(grep { $_ } ($self->{decrypted_file}));
32 }
33  
34 13 1;
« Brackup/Target/CloudFiles.pm ↑ Summary Brackup/CompositeChunk.pm »