diff options
Diffstat (limited to 'Master/tlpkg/tlperl/lib/Win32/Exe/Base.pm')
-rwxr-xr-x | Master/tlpkg/tlperl/lib/Win32/Exe/Base.pm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Master/tlpkg/tlperl/lib/Win32/Exe/Base.pm b/Master/tlpkg/tlperl/lib/Win32/Exe/Base.pm new file mode 100755 index 00000000000..a90ec19c451 --- /dev/null +++ b/Master/tlpkg/tlperl/lib/Win32/Exe/Base.pm @@ -0,0 +1,35 @@ +# $File: //local/member/autrijus/Win32-Exe/lib/Win32/Exe/Base.pm $ $Author: autrijus $ +# $Revision: #8 $ $Change: 1130 $ $Date: 2004-02-17T15:40:29.640821Z $ + +package Win32::Exe::Base; + +use strict; +use base 'Parse::Binary'; +use constant BASE_CLASS => 'Win32::Exe'; +use constant FORMAT => ( + Data => 'a', +); + +sub align { + my ($self, $value, $boundary) = @_; + my $n = ($value % $boundary) or return $value; + return($value + $boundary - $n); +} + +sub pad { + my ($self, $value, $bounary) = @_; + my $x = length($value) % $bounary or return ''; + return "\0" x ($bounary - $x); +} + +sub decode_ucs2 { + my ($self, $string) = @_; + return join('', map chr($_), unpack("v*", $string)); +} + +sub encode_ucs2 { + my ($self, $string) = @_; + return pack("v*", map ord($_), split(//, $string)); +} + +1; |