I'm trying to send packed data through RabbitMQ using Net::RabbitMQ, and am running into problems with the data being munged on the way into the library.
I'm packing a couple strings using pack("n/an/a", $str1, $str2). If I hexdump the buffer it looks as I expect:
03 B0 2D 2D 2D 0A 43 4F - 4E 54 45 4E 54 5F 4C 45 ..---.CONTENT_LE
All is good, 03 B0 == 944 == the length of $str1. However, when I invoke the RabbitMQ method Net::RabbitMQ::publish, an XS method which I have hacked to print the first few bytes of the input data, I find it has been changed to 03 c2 b0 2d. This feels like a charset manipulation is going on.
If I add use bytes to the module invoking the call, all is well. However, the documentation for use bytes strongly discourages its use for anything other than documentation. It is unclear to me exactly how to properly proceed.
This is with perl 5.12.2 on 64-bit intel.
Thank you for your wisdom,
--bob
In reply to use bytes vs packed data by RDOlson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |