| 1 | # Copyright 2004 by Audrey Tang <cpan@audreyt.org> | ||||||||||
| 2 | |||||||||||
| 3 | package Win32::Exe::Base; | ||||||||||
| 4 | |||||||||||
| 5 | 5 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 5 | ▶ | use base 'Parse::Binary'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 5 | ▶ | use constant BASE_CLASS => 'Win32::Exe'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 5 | ▶ | use constant FORMAT => ( | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | Data => 'a', | ||||||||||
| 10 | 5 | ); | |||||||||
| 11 | |||||||||||
| 12 | 417 | ▶ | sub align { | ||||||||
|
Subroutine
align: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 13 | 417 | my ($self, $value, $boundary) = @_; | |||||||||
| 14 | 417 | ▶ | my $n = ($value % $boundary) or return $value; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 107 | return($value + $boundary - $n); | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | 106 | ▶ | sub pad { | ||||||||
|
Subroutine
pad: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 19 | 106 | my ($self, $value, $bounary) = @_; | |||||||||
| 20 | 106 | ▶ | my $x = length($value) % $bounary or return ''; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 34 | return "\0" x ($bounary - $x); | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 230 | ▶ | sub decode_ucs2 { | ||||||||
|
Subroutine
decode_ucs2: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 25 | 230 | my ($self, $string) = @_; | |||||||||
| 26 | 230 | return join('', map chr($_), unpack("v*", $string)); | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 46 | ▶ | sub encode_ucs2 { | ||||||||
|
Subroutine
encode_ucs2: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 30 | 46 | my ($self, $string) = @_; | |||||||||
| 31 | 46 | return pack("v*", map ord($_), split(//, $string)); | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 5 | 1; | |||||||||