Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid operation on binary string #6

Closed
bbkr opened this issue Jan 3, 2013 · 3 comments
Closed

Invalid operation on binary string #6

bbkr opened this issue Jan 3, 2013 · 3 comments

Comments

@bbkr
Copy link

bbkr commented Jan 3, 2013

I was writing blogpost about RPC communication in Perl6 and I've noticed that on latest Rakudo Star 2012.12 HTTP::Easy breaks with following error:

$ perl6 librarian.pl 
[2013-01-03T23:01:52Z] Started HTTP server.
[2013-01-03T23:02:22Z] POST / HTTP/1.1
Invalid operation on binary string
  in method uc at src/gen/CORE.setting:2206
  in method dispatch:<.=> at src/gen/CORE.setting:945
  in block  at /Users/bbkr/Developer/Perl6/rakudo/install/lib/parrot/4.10.0/languages/perl6/lib/HTTP/Easy.pm6:93
  in method reify at src/gen/CORE.setting:5495
  in method reify at src/gen/CORE.setting:5397
  in method reify at src/gen/CORE.setting:5397
  in method gimme at src/gen/CORE.setting:5775
  in method eager at src/gen/CORE.setting:5754
  in method eager at src/gen/CORE.setting:1189
  in sub eager at src/gen/CORE.setting:6052
  in method run at /Users/bbkr/Developer/Perl6/rakudo/install/lib/parrot/4.10.0/languages/perl6/lib/HTTP/Easy.pm6:88
  in method run at /Users/bbkr/Developer/Perl6/rakudo/install/lib/parrot/4.10.0/languages/perl6/lib/JSON/RPC/Server.pm:40
  in block  at librarian.pl:39

To reproduce one can run librarian.pl and then client.pl from article link above.

It was working fine with 2012.11 release. I'm not sure if broken IO::Socket.read(?) method is related to this issue.

@supernovus
Copy link
Collaborator

I am not quite sure why the results of a .get() call, which is later .split, is being considered a "binary string". This certainly was not happening in previous versions of Rakudo.

@bbkr
Copy link
Author

bbkr commented Jan 4, 2013

Parrot had some major socket changes
parrot/parrot#909

Indeed binary string is returned, for example sending euro sign over sockets:

my $listener = IO::Socket::INET.new( localhost => "", localport => 8080, :listen );
while my $connection = $listener.accept( ) {
    $connection.send( "\x[20ac]\r\n" );
    $connection.close( );
}

2012.11 works fine

$ perl6 -e 'my $client = IO::Socket::INET.new( host => "localhost", port => 8080 ); my $inc = $client.get; say $inc.uc'
€

2012.12 breaks

perl6 -e 'my $client = IO::Socket::INET.new( host => "localhost", port => 8080 ); my $inc = $client.get; say $inc.uc'
Invalid operation on binary string
  in method uc at src/gen/CORE.setting:2206
  in block  at -e:1

I've already reported it in RT https://rt.perl.org/rt3//Ticket/Display.html?id=116302

So far the only workaround is to explicitly convert it into utf string:

say $inc.encode("binary").decode.uc
€

@bbkr
Copy link
Author

bbkr commented Jan 24, 2013

fixed in rakudo/rakudo@0b5899a
moritz++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants