in reply to signed and unsigned templates in pack/unpack
The 'l' template gives a signed 32-bit value which will be different on big or little endian hardware. See the pack() perldoc.
So in answer to your question, this is normal behaviour. If you are getting different behaviour on Windows it shouldn't be due to this line of code, per se, but rather to how the return value is used. *
In this particular case I'd guess that the issue isn't that the pid is being unpacked as 'N' or 'l' but rather that it is being repacked as 'I' rather than 'N'. That is just a guess though, without digging further into the code.
* What seems strange about using 'l' in this case is that it could give a negative pid on Windows. Is that valid? If not then it is an indication that the problem lies elsewhere.
P.S. The '1' in the unpack templates is superfluous and in the case of 'l1' a little confusing.
--
John.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: signed and unsigned templates in pack/unpack
by posti (Novice) on Mar 02, 2010 at 12:42 UTC | |
by BrowserUk (Patriarch) on Mar 02, 2010 at 12:59 UTC | |
by posti (Novice) on Mar 02, 2010 at 13:53 UTC |