Create/Tar.pm

filter: Statementstmt 100% 24 / 24 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 5 totaltotal 82.5% 33 / 40 CC 3 SCAR 5.3
CC
3
Cov
93%
write_filehandle
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« Create.pm ↑ Summary Create/Zip.pm »
1 package Archive::Any::Create::Tar;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 ▶use Archive::Tar;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod undocumented
7 2 my $self = shift;
8 2 my($opt) = @_;
9 2 $self->{tar} = Archive::Tar->new;
10 2 $self->{comp} = $opt->{comp};
11 }
12  
13 2 ▶sub container {
Subroutine container: called CC=1 SCAR=0.0
Pod undocumented
14 2 my $self = shift;
15 2 my($dir) = @_;
16 2 $self->{container} = $dir;
17 }
18  
19 4 ▶sub add_file {
Subroutine add_file: called CC=1 SCAR=0.0
Pod undocumented
20 4 my $self = shift;
21 4 my($file, $data) = @_;
22 4 $self->{tar}->add_data($file, $data);
23 }
24  
25 1 ▶sub write_file {
Subroutine write_file: called CC=1 SCAR=0.0
Pod undocumented
26 1 my $self = shift;
27 1 return $self->write_filehandle(@_); # Accepts files or handles
28 }
29  
30 2 ▶sub write_filehandle {
Subroutine write_filehandle: called CC=3 SCAR=11.3
Pod undocumented
31 2 my $self = shift;
32 2 my($fh) = @_;
33 2 ▶ my $comp = $self->{comp} ? COMPRESS_GZIP : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'comp'} ? : 2 0 2
34 $self->{tar}->write($fh, $comp, $self->{container})
35 2 ▶ or throw Archive::Any::Create::Error(error => $self->{tar}->error);
Branch: 1 branch
BranchTrueFalseTotal
$self->{"tar"}->write($fh, $comp, $self->{"container"}) or "Archive::Any::Create::Error"->throw("error", $self->{"tar"}->error) 2 0 2
36 2 1;
37 }
38  
39 1 1;
« Create.pm ↑ Summary Create/Zip.pm »