blib/lib/Archive/Tar/Streamed.pm

filter: Statementstmt 100% 35 / 35 Branchbran 75.0% 3 / 4 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 10 / 10 Podpod 50.0% 2 / 4 totaltotal 94.6% 53 / 56 CC 4 SCAR 4.8
CC
4
Cov
98%
next
3.0
add
2.0
BEGIN
1.0
CRAP 1.6
↑ Summary
1  
2 package Archive::Tar::Streamed;
3 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 5 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶ use vars qw ($VERSION @ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 $VERSION = 0.03;
8 }
9  
10 5 ▶use Archive::Tar;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 5 ▶use Archive::Tar::Constant;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 4 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
15 4 my ($pkg,$arch) = @_;
16  
17 4 bless {file => $arch}, $pkg;
18 }
19  
20 6 ▶sub add {
Subroutine add: called CC=2 SCAR=7.0
Pod documented
21 6 my $self = shift;
22  
23 6 my $arch = Archive::Tar->new;
24 6 ▶ $arch->add_files(@_) or croak "add: $!";
Branch: 1 branch
BranchTrueFalseTotal
$arch->add_files(@_) or croak("add: $!") 6 0 6
25 6 my $tf = $arch->write;
26 6 syswrite $self->{file}, $tf, length($tf) - (BLOCK * 2);
27 }
28  
29 19 ▶sub next {
Subroutine next: called CC=3 SCAR=11.0
Pod documented
30 19 my $self = shift;
31  
32 19 ▶ $self->{pending} ||= [];
Condition100%2/2
$self->{"pending"} ||= []
l!l
154
MC/DC100%1/1
$self->{"pending"} ||= []
$self->{"pending"}
Truth table100%2/2
A
A= $self->{"pending"}
Aresult
11
00
33 19 ▶ return shift @{$self->{pending}} if @{$self->{pending}};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->{"pending"};} 1 18 19
34 18 my $arch = Archive::Tar->new;
35 18 my ($fil,@pend) = $arch->read( $self->{file}, 0, {limit => 1});
36 18 $self->{pending} = \@pend;
37 18 $fil;
38 }
39  
40 3 ▶sub writeeof {
Subroutine writeeof: called CC=1 SCAR=0.0
Pod undocumented
41 3 my $self = shift;
42  
43 3 syswrite $self->{file},TAR_END;
44 }
45  
46 5 1;
47 __END__
↑ Summary