Advertisement
Guest User

Rakudo input-line-separator on different backends

a guest
Mar 30th, 2014
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.53 KB | None | 0 0
  1. simula67@hades ~/repos/perl6/7test » cat server.p6
  2. #!/opt/perl6/bin/perl6
  3. constant DOUBLE_CRLF = "\x0D\x0A\x0D\x0A";
  4. #constant DOUBLE_CRLF = "END";
  5. my $listener = IO::Socket::INET.new(
  6.         :localhost("0.0.0.0"),
  7.         :localport(3000),
  8.         :listen(1),
  9.         :input-line-separator(DOUBLE_CRLF)
  10.     );
  11. say "Listening..";
  12. while my $client = $listener.accept {
  13.         my Str $preamble = $client.get;
  14.     say $preamble;
  15.     say "preamble has " ~ $preamble.chars ~ " chars";
  16.     $client.close;
  17. }
  18. simula67@hades ~/repos/perl6/7test » cat client.p6
  19. #!/opt/perl6/bin/perl6
  20. constant CRLF = "\x0D\x0A";
  21.  
  22. my $socket = IO::Socket::INET.new(
  23.     host  => '127.0.0.1',
  24.     port  =>  3000,
  25.     Proto => 'tcp',
  26. ) or die "Couldn't connect to Server\n";
  27. $socket.send("Some stuff" ~ CRLF);
  28. $socket.send("Got more stuff END" ~ CRLF);
  29. $socket.send(CRLF);
  30.  
  31.  
  32.  
  33.  
  34.  
  35. simula67@hades ~/repos/perl6/7test » perl6-m server.p6         #  MOAR OUTPUT IS WRONG !!!!!!!!!!!!
  36. Listening..                         #  MOAR OUTPUT IS WRONG !!!!!!!!!!!!
  37. Some stuff                          #  MOAR OUTPUT IS WRONG !!!!!!!!!!!!
  38.                                 #  MOAR OUTPUT IS WRONG !!!!!!!!!!!!
  39. preamble has 12 chars                       #  MOAR OUTPUT IS WRONG !!!!!!!!!!!!
  40. ^C
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47. simula67@hades ~/repos/perl6/7test » perl6-j server.p6
  48. Listening..
  49. Some stuff
  50. Got more stuff END
  51. preamble has 30 chars
  52. ^C%                                                                                                               simula67@hades ~/repos/perl6/7test » perl6-p server.p6
  53. Listening..
  54. Some stuff
  55. Got more stuff END
  56. preamble has 30 chars
  57. ^C
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement