Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

packing and unpacking data structure with Perl6

Tags:

pack

unpack

raku

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 ?

like image 408
smith Avatar asked May 24 '16 21:05

smith


2 Answers

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.

like image 137
Coke Avatar answered Nov 16 '22 11:11

Coke


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.

like image 1
suhao399 Avatar answered Nov 16 '22 11:11

suhao399