I'm trying to unpack an unsigned long value that is passed from a C program to a Perl script via SysV::IPC.
It is known that the value is correct (I made a test which sends the same value into two queues, one read by Perl and the second by the C application), and all predecessing values are read correctly (used q
instead of i!
to work with 64-bit integers).
It is also known that PHP had something similar in bugs (search for "unsigned long on 64 bit machines") (seems to be similar: Pack / unpack a 64-bit int on 64-bit architecture in PHP)
Arguments tested so far:
- ..Q ( = some value that is larger than expected)
- ..L ( = 0)
- ..L! ( = large value)
- ..l ( = 0)
- ..l! ( = large value)
- ..lN! ( = 0)
- ..N, ..N! ( = 0)
use bigint; use bignum;
-- no effect.
Details:
sizeof(unsigned long)
= 8;Data::Dumper->new([$thatstring])->Useqq(1)->Dump();
a lot of null bytes along some meaningful..- byteorder='12345678';
Solution:
- x4Q
with padding four bytes.