Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Incompatibility after perl 5.10 packing and UTF-8 strings

by powerperl (Initiate)
on Aug 03, 2022 at 18:18 UTC ( #11145921=perlquestion: print w/replies, xml ) Need Help??

powerperl has asked for the wisdom of the Perl Monks concerning the following question:

You can refer incompatibility in perldelta doc of v5.10. My concern is I am upgrading old perl before v5.10 to v5.20. Should I worry about it. How to identify if this incompatibility is serious concern for me. I my codebase I found lot of usage of pack and unpack. It is mentioned that 'use bytes' will give old behaviour back.

Can we do it everywhere ? How to handle this incompatibility in general if we are jumping from version before 5.10 to version after 5.10 that is 5.20. I know that it is complex to take such high jump I am trying to take care of everything. Good explanation will help me here.

  • Comment on Incompatibility after perl 5.10 packing and UTF-8 strings

Replies are listed 'Best First'.
Re: Incompatibility after perl 5.10 packing and UTF-8 strings
by davido (Cardinal) on Aug 03, 2022 at 20:00 UTC

    So I don't have to go searching for the specific paragraph in perldelta that you are referring to, how about pasting it into your question?

    Should you worry about it? I think the answer is yes, if you feel you might be triggering an incompatibility, until you can prove through tests that you've handled it appropriately. How do you identify if it's a concern? Write a test, or a bunch of tests that prove your code does as intended before and after the upgrade.

    See Test::More, and chromatic's Perl Testing: A Developer's Notebook, or Intermediate Perl for testing strategies.


    Dave

Re: Incompatibility after perl 5.10 packing and UTF-8 strings
by ikegami (Patriarch) on Aug 03, 2022 at 20:40 UTC
Re: Incompatibility after perl 5.10 packing and UTF-8 strings (perlver - The Perl Minimum Version Analyzer)
by Anonymous Monk on Aug 04, 2022 at 08:20 UTC

      I don't think any of those can determine if the code relies on the buggy behaviour of 5.8's pack and unpack or not.

pack unpack incompatibility issue
by powerperl (Initiate) on Aug 03, 2022 at 18:31 UTC

    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); 

      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

      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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11145921]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2022-08-14 21:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?