You are using ~, which stringifies. Bufs are not strings: you need to
decode them to concatenate it to a string. If what you want is to
concatenate the buffer, probably ,= will work (not sure about this, would
have to check), or any other operator that works on Positionals.

JJ

El mar., 11 feb. 2020 a las 10:56, David Santiago (<deman...@gmail.com>)
escribió:

> A 11 de fevereiro de 2020 10:47:34 CET, David Santiago <deman...@gmail.com>
> escreveu:
> >A 11 de fevereiro de 2020 09:46:06 CET, David Santiago <
> deman...@gmail.com> escreveu:
> >>
> >>Hi!
> >>
> >>Can someone explain me why this doesn't work:
> >>
> >>my Blob $read;
> >>$read ~= $socket.read(1024);
> >>
> >>Dies with error:
> >>
> >>X::Buf::AsStr: Cannot use a Buf as a string, but you called the Stringy
> method on it
> >>
> >>This also doesn't work:
> >>
> >>my Buf $read;
> >>$read ~= $socket.read(1024);
> >>
> >>Dies with the same error as above.
> >>
> >>
> >>But this works?
> >>
> >>my Blob $read = Buf.new;
> >>$read ~= $socket.read(1024);
> >>
> >>
> >>Best regards,
> >>David Santiago
> >
> >
> >Hi!
> >
> >Can someone explain me why this doesn't work:
> >
> >my Blob $read;
> >$read ~= $socket.read(1024);
> >
> >Dies with error:
> >
> >X::Buf::AsStr: Cannot use a Buf as a string, but you called the Stringy
> method on it
> >
> >This also doesn't work:
> >
> >my Buf $read;
> >$read ~= $socket.read(1024);
> >
> >Dies with the same error as above.
> >
> >
> >But this works?
> >
> >my Blob $read = Buf.new;
> >$read ~= $socket.read(1024);
> >
> >
> >Best regards,
> >David Santiago
>
>
> Hi!
>
> Can someone explain me why this doesn't work:
>
> my Blob $read;
> $read ~= $socket.read(1024);
>
> Dies with error:
>
> X::Buf::AsStr: Cannot use a Buf as a string, but you called the Stringy
> method on it
>
> This also doesn't work:
>
> my Buf $read;
> $read ~= $socket.read(1024);
>
> Dies with the same error as above.
>
>
> But this works?
>
> my Blob $read = Buf.new;
> $read ~= $socket.read(1024);
>
>
> Best regards,
> David Santiago
>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>


-- 
JJ

Reply via email to