| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 28 | 296 | $level = ord( $level ); | |||||||||||||||||||||||||||
| 29 | 296 | ▶ | if ( $method && $level =~ /^(?:[0-2])$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$method and $level =~ /^(?:[0-2])$/
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])$/
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||