I faced a similar problem while writting Net::SFTP::Foreign.
My solution was to create a set of functions which pop the data from the buffer, allowing me to write code as the following:
This is the module implementing those functions: Net::SFTP::Foreign::Buffer.my $buffer = read ...; my $len = get_int32($buffer); my $cmd = get_int8($buffer); my $txt = get_string($buffer);
|Replies are listed 'Best First'.|
Re^2: Unpacking byte stream long/quad little/big endian fields
by GrandFather (Saint) on Jan 22, 2021 at 08:32 UTC