in reply to Incompatibility after perl 5.10 packing and UTF-8 strings

How to identify incompatible use of pack and unpack. And how to fix it for following examples if they are incompatible uses. I want to use code around it in perl 5.22. This is present in perl 5.8 currently and working fine. I dont know if it will break or work when I upgrade perl to v5.22

pack("$L", unpack("$L", $_) sprintf("%08x", unpack("N",function($relay)));  push(@rv, join('.', unpack("CCCC", function($i))));  unpack("u", $len . $1 );  unpack("w*", $v);  unpack("V", $v) == 1 unpack("x$start_offset x4 $L$L$L$L$S$S$L$L", $file);  unpack("x$d_off $S/a", $file);  unpack("H*", shift); 

Replies are listed 'Best First'.
Re: pack unpack incompatibility issue
by davido (Cardinal) on Aug 03, 2022 at 19:56 UTC

    What is $L?

    Can't debug pack/unpack templates that we can't see.

    You should create a small segment of code starting with use strict, and ending with a __DATA__ tag that contains some sample data, and that demonstrates your packing and unpacking (which presumably aren't working as you intend), along with a good description of what you actually do intend. Self-contained. We should be able to run it and see the failure.


    Dave

Re: pack unpack incompatibility issue
by ikegami (Patriarch) on Aug 03, 2022 at 20:33 UTC

    I don't think any of them will have any issues except possibility differences in warnings for bad data.

    I know that pack changed how it handled some invalid inputs, but that's not relevant here.

    Upd: Looks like you found a possible source of problems: Incompatibility after perl 5.10 packing and UTF-8 strings

Re: pack unpack incompatibility issue
by LanX (Saint) on Aug 03, 2022 at 20:54 UTC
Re: pack unpack incompatibility issue
by afoken (Chancellor) on Aug 04, 2022 at 16:49 UTC