lib/Win32/Exe/PE/Header/PE32.pm

filter: Statementstmt 100% 32 / 32 Branchbran 50.0% 1 / 2 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 11 / 11 Podpod 0.0% 0 / 5 totaltotal 79.3% 46 / 58 CC 4 SCAR 5.0
CC
4
Cov
90%
st_to_id
3.2
id_to_st
2.3
BEGIN
1.0
CRAP 1.7
« lib/Win32/Exe/Section/Exports.pm ↑ Summary lib/Win32/Exe/PE/Header/PE32Plus.pm »
1 # Copyright 2004 by Audrey Tang <cpan@audreyt.org>
2  
3 package Win32::Exe::PE::Header::PE32;
4  
5 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use base 'Win32::Exe::PE::Header';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use constant SUBFORMAT => (
Subroutine BEGIN: called CC=1 SCAR=0.0
8 BaseOfData => 'V',
9 ImageBase => 'V',
10 SectionAlign => 'V',
11 FileAlign => 'V',
12 OSMajor => 'v',
13 OSMinor => 'v',
14 UserMajor => 'v',
15 UserMinor => 'v',
16 SubsysMajor => 'v',
17 SubsysMinor => 'v',
18 _ => 'a4',
19 ImageSize => 'V',
20 HeaderSize => 'V',
21 FileChecksum => 'V',
22 SubsystemTypeId => 'v',
23 DLLFlags => 'v',
24 StackReserve => 'V',
25 StackCommit => 'V',
26 HeapReserve => 'V',
27 HeapCommit => 'V',
28 LoaderFlags => 'V',
29 NumDataDirs => 'V',
30 'DataDirectory' => [
31 'a8', '{$NumDataDirs}', 1
32 ],
33 'Section' => [
34 'a40', '{$NumSections}', 1
35 ],
36 Data => 'a*',
37 5 );
38 5 ▶use constant SUBSYSTEM_TYPES => [qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
39 _ native windows console _
40 _ _ posix _ windowsce
41 5 )];
42 5 ▶use constant ST_TO_ID => {
Subroutine BEGIN: called CC=1 SCAR=0.0
43 5 map { (SUBSYSTEM_TYPES->[$_] => $_) } (0 .. $#{+SUBSYSTEM_TYPES})
44 5 };
45 5 ▶use constant ID_TO_ST => { reverse %{+ST_TO_ID} };
Subroutine BEGIN: called CC=1 SCAR=0.0
46  
47 2 ▶sub st_to_id {
Subroutine st_to_id: called CC=3 SCAR=11.7
Pod undocumented
48 2 my ($self, $name) = @_;
49 2 ▶ return $name unless $name =~ /\D/;
Branch: 1 branch
BranchTrueFalseTotal
unless $name =~ /\D/ 0 2 2
50 2 ▶ return(+ST_TO_ID->{lc($name)} || die "No such type: $name");
Condition50%1/2
{_ => 8, console => 3, native => 1, posix => 7, windows => 2, windowsce => 9}->{lc $name} || die("No such type: $name")
l!l
20
MC/DC0%0/1
{_ => 8, console => 3, native => 1, posix => 7, windows => 2, windowsce => 9}->{lc $name} || die("No such type: $name")
{_ => 8, console => 3, native => 1, posix => 7, windows => 2, windowsce => 9}->{lc $name}
Truth table50%1/2
A
A= {_ => 8, console => 3, native => 1, posix => 7, windows => 2, windowsce => 9}->{lc $name}
Aresult
11
00
51 }
52  
53 3 ▶sub id_to_st {
Subroutine id_to_st: called CC=2 SCAR=8.1
Pod undocumented
54 3 my ($self, $id) = @_;
55 3 ▶ return(+ID_TO_ST->{$id} || $id);
Condition33%1/3
{1 => 'native', 2 => 'windows', 3 => 'console', 7 => 'posix', 8 => '_', 9 => 'windowsce'}->{$id} || $id
l!l&&r!l&&!r
300
MC/DC0%0/2
{1 => 'native', 2 => 'windows', 3 => 'console', 7 => 'posix', 8 => '_', 9 => 'windowsce'}->{$id} || $id
{1 => 'native', 2 => 'windows', 3 => 'console', 7 => 'posix', 8 => '_', 9 => 'windowsce'}->{$id} $id
Truth table33%1/3
A || B
A= {1 => 'native', 2 => 'windows', 3 => 'console', 7 => 'posix', 8 => '_', 9 => 'windowsce'}->{$id}B= $id
ABresult
1X1
011
000
56 }
57  
58 3 ▶sub Subsystem {
Subroutine Subsystem: called CC=1 SCAR=0.0
Pod undocumented
59 3 my ($self) = @_;
60 3 return $self->id_to_st($self->SubsystemTypeId);
61 }
62  
63 2 ▶sub SetSubsystem {
Subroutine SetSubsystem: called CC=1 SCAR=0.0
Pod undocumented
64 2 my ($self, $type) = @_;
65 2 $self->SetSubsystemTypeId($self->st_to_id($type));
66 }
67  
68  
69 6 ▶sub ExpectedOptHeaderSize { 224 };
Subroutine ExpectedOptHeaderSize: called CC=1 SCAR=0.0
Pod undocumented
70  
71  
72 5 1;
« lib/Win32/Exe/Section/Exports.pm ↑ Summary lib/Win32/Exe/PE/Header/PE32Plus.pm »