RDOlson has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: use bytes vs packed data
by choroba (Cardinal) on May 02, 2011 at 16:25 UTC | |
by RDOlson (Initiate) on May 02, 2011 at 18:17 UTC | |
|
Re: use bytes vs packed data
by John M. Dlugosz (Monsignor) on May 02, 2011 at 23:26 UTC | |
|
Re: use bytes vs packed data
by John M. Dlugosz (Monsignor) on May 03, 2011 at 04:57 UTC | |
by RDOlson (Initiate) on May 03, 2011 at 15:49 UTC | |
by John M. Dlugosz (Monsignor) on May 04, 2011 at 02:05 UTC | |
by ikegami (Patriarch) on May 04, 2011 at 16:45 UTC | |
by John M. Dlugosz (Monsignor) on May 04, 2011 at 21:43 UTC | |
|
Re: use bytes vs packed data
by ikegami (Patriarch) on May 04, 2011 at 16:44 UTC | |
by RDOlson (Initiate) on May 04, 2011 at 19:56 UTC | |
by ikegami (Patriarch) on May 05, 2011 at 16:08 UTC | |
by RDOlson (Initiate) on May 05, 2011 at 21:55 UTC |