# New Ticket Created by RainbowZephyr
# Please include the string: [perl #130568]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=130568 >
perl6 --version:
This is Rakudo version 2016.12 built on MoarVM version 2016.12
OS: Arch Linux using GCC compiler and MoarVM
Using .hyper on an array sometimes returns a result and most of the
times it does not. Additionally using .hyper may cause the entire
process to sleep and no output returns.
Code:
use experimental :pack;
my $file = slurp("pic.png", :bin);
my $start = 8;
my $end = 11;
my $len = 0;
my $header = "";
my $data = "";
while $end <= $file.bytes {
$len = :16(Blob.new($file[$start..$end]).unpack("H*")) ;
$header = Blob.new($file[$start+4..$end+4]).unpack("H*");
#!!!!!!!!!!!!!!!!!Problem is here!!!!!!!!!!!!!!!!!
$data = $file[$start+8 ..$start+8+$len].hyper.map({$_
.fmt('%02x')}).list;
say $data;
$start = $start + $len + 12 ;
$end = $start + 3;
}
expected output (Omitting .hyper and using only first 3 lines of
output):
(00 00 01 85 00 00 02 6c 08 06 00 00 00 12)
(08 08 08 08 7c)
(53 6f 66 74 77 61 72 65 00 67 6e 6f 6d 65 2d 73 63 72 65 65 6e 73 68
6f 74 ef)
actual output:
()
()
()
*process sleeps here*