File Coverage

lib/Archive/Lha/Header.pm
Criterion Covered Total %
statement 24 24 100.0
branch 3 6 50.0
condition n/a
subroutine 7 7 100.0
pod 1 1 100.0
total 35 38 92.1


line stmt bran cond sub pod time code
1             package Archive::Lha::Header;
2            
3 17     17   236218 use strict;
  17         40  
  17         673  
4 17     17   96 use warnings;
  17         34  
  17         842  
5 17     17   89 use Carp;
  17         41  
  17         1144  
6 17     17   8201 use Archive::Lha::Header::Level0;
  17         62  
  17         275  
7 17     17   9100 use Archive::Lha::Header::Level1;
  17         55  
  17         193  
8 17     17   8389 use Archive::Lha::Header::Level2;
  17         80  
  17         189  
9            
10             my @_parsers = (
11             'Archive::Lha::Header::Level0',
12             'Archive::Lha::Header::Level1',
13             'Archive::Lha::Header::Level2',
14             );
15            
16             sub new {
17 296     296 1 1363 my ($class, %options) = @_;
18            
19 296 50       689 croak "Stream is missing" unless defined $options{stream};
20 296 50       564 croak "Header level is missing" unless defined $options{level};
21            
22 296         471 my $level = $options{level};
23 296 50       775 croak "Illegal header level: $level"
24             unless $level =~ /^[0-2]$/;
25            
26 296         1222 $_parsers[$level]->new( $options{stream} );
27             }
28            
29             1;
30            
31             __END__