lib/Archive/Lha/Stream/Base.pm

filter: Statementstmt 91.8% 34 / 37 Branchbran 75.0% 6 / 8 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 72.7% 8 / 11 Podpod 100% 8 / 8 totaltotal 82.6% 57 / 69 CC 6 SCAR 11.4
CC
6
Cov
85%
search_header
6.1
open
2.0
close
2.0
CRAP 3.1
« lib/Archive/Lha/Header/Level1.pm ↑ Summary lib/Archive/Lha/Header/Level2.pm »
1 package Archive::Lha::Stream::Base;
2
3 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 17 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 17 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6
7 24 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
8 24 my $class = shift;
9 24 my $self = bless {}, $class;
10 24 $self->open(@_);
11 24 $self;
12 }
13
14 0 ▶sub open { croak "override" }
Subroutine open: not called CC=1 SCAR=6.9
Pod documented
15
16 0 ▶sub close { return }
Subroutine close: not called CC=1 SCAR=6.9
Pod documented
17
18 317 ▶sub search_header {
Subroutine search_header: called CC=6 SCAR=18.1
Pod documented
19 317 my $self = shift;
20
21 317 my $str = '';
22 317 my $count = 0;
23 317 my $pos = $self->tell;
24 317 ▶ until ( $self->eof ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->eof) 316 21 337
25 316 $str .= $self->read(1024);
26 316 my ($method, $level) = $str =~ /.{2}\-(lh[0-9a-z]|lzs|lz[45]|pm[012])\-.{13}(.)/s;
27 316 ▶ if ( defined $level ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $level) 296 20 316
28 296 $level = ord( $level );
29 296 ▶ if ( $method && $level =~ /^(?:[0-2])$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($method and $level =~ /^(?:[0-2])$/) 296 0 296
Condition33%1/3
$method and $level =~ /^(?:[0-2])$/
!ll&&!rl&&r
00296
MC/DC0%0/2
$method and $level =~ /^(?:[0-2])$/
$method $level =~ /^(?:[0-2])$/
Truth table33%1/3
A and B
A= $methodB= $level =~ /^(?:[0-2])$/
ABresult
0X0
100
111
30 296 $self->seek( $pos );
31 296 return $level;
32 }
33 }
34 20 $str = substr( $str, -21 );
35 20 ▶ last if ++$count > 63; # further check would be fruitless
Branch: 1 branch
BranchTrueFalseTotal
if ++$count > 63 0 20 20
36 }
37 21 return;
38 }
39
40 20 ▶sub eof {
Subroutine eof: called CC=1 SCAR=0.0
Pod documented
41 20 my $self = shift;
42
43 20 $self->{pos} >= $self->{length};
44 }
45
46 36 ▶sub seek {
Subroutine seek: called CC=1 SCAR=0.0
Pod documented
47 36 my ($self, $offset) = @_;
48 36 $self->{pos} = $offset;
49 }
50
51 28 ▶sub tell { shift->{pos} }
Subroutine tell: called CC=1 SCAR=0.0
Pod documented
52
53 0 ▶sub read { croak "override" }
Subroutine read: not called CC=1 SCAR=6.9
Pod documented
54
55 17 1;
56
57 __END__
« lib/Archive/Lha/Header/Level1.pm ↑ Summary lib/Archive/Lha/Header/Level2.pm »