> Somehow this doesn't look IO related to me.

Yes, you're perhaps right.

How about Data::Buffer? Any other suggestions?

>> All of the I<get_*> and I<put_*> methods respect the
>> internal offset state in the buffer object. This means
>> that, for example, if you call I<get_int16> twice in a
>> row, you can be ensured that you'll get the next two
>> 16-bit integers in the buffer.> Does that mean that
> 
> $buf->put_int16(24);
> $buf->put_int32(1233455);
> $buf->put_int16(99);
> 
> $buf->get_int16   # 24
> $buf->get_int16   # 99
> $buf->get_int32   # 1233455

No, sorry to be unclear. The get_* methods have to respect the order in
which data was placed into the buffer by the put_* methods. So, for example,
this is true:

    $buf->put_int16(24);
    $buf->put_int32(1233455);
    $buf->put_int16(99);

    $buf->get_int16   # 24
    $buf->get_int32   # 1233455
    $buf->get_int16   # 99

In other words, the last two lines in your code should be swapped. Data
comes out in the same order in which it went in to the buffer.

I'll give a better example in the docs (ie. like this example).

bye,
Ben

Reply via email to