packing and unpacking data structure with Perl6
Asked Answered
E

2

7

on perl5 if someone want to parse binary file he has the pack/unpack utiltiy where he can convert binary structure to perl variables and vice verca ,

is there now a production equivlant for pack/unpack on perl6 ,as from the documentation i found that there are pack/unpack methods for Perl6 but they are experimental ,

does anyone know the status of those functions and if there are alternative to parse binary file which contains a list of records on perl6 ?

Exportation answered 24/5, 2016 at 21:3 Comment(1)
I am using rakudo. This pack("C*", [1, 2, 3]); => Buf:0x<01>.Hedden
S
7

You are correct, the pack/unpack methods are experimental; there is currently no other method that is recommended in their place, however.

The experimental flag indicates that the Perl 6 dev team may change the interface. pack & unpack were marked in this way because there was not enough time to review and update the interface before the Christmas release in 2015-12.

Sapphire answered 25/5, 2016 at 13:40 Comment(0)
H
1

I am using rakudo:

use experimental :pack;

pack("C*", [1, 2, 3]); => Buf:0x<01>

I am not sure this is correct use. I expect all bytes get packed in.

Hedden answered 22/5, 2018 at 11:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.