John Holdsworth writes: > Included is a bug fix to the decode of unpack 'N/Z*' which > was not adding a byte to the encoded length as pack does. Not clear. unpack 'N/Z*' with N unpacking to 14 should be the same as Z14. Is it? > There is also option to use 'N/a*4' to round the length of encoded > strings to four bytes as required by SUN XDR RFC 1832. I think a more general command is needed. Say, 'x!8' which would add 0-bytes until the next position which is multiple of 8. Then you would write 'N/a*x!4'. > More contentiously perhaps the code also supports a new length > character '?' which steals the length from the next argument. > This allows multiple arrays to be encoded and decoded viz.: > > my @arr = (1,2,3,4); > my $packed = pack "N/N?N/N?", scalar @arr, @arr, scalar @arr, @arr; Again, something more general is needed. Something like my $packed = pack "(N//N)(N//N)", scalar @arr, @arr, scalar @arr, @arr; or similar. IlyaThread Previous | Thread Next