X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FIntMsg.pm;h=8065f3024e5c693e04e7b50620a5d136e83c2a00;hb=586cbb347e7639f5575b48572e75140501a109c0;hp=150ec91a2f0a860c9a63ad73a2f2a81c74d73a2e;hpb=e674587476599456cce169e02b0e441d985f9dd8;p=spider.git diff --git a/perl/IntMsg.pm b/perl/IntMsg.pm index 150ec91a..8065f302 100644 --- a/perl/IntMsg.pm +++ b/perl/IntMsg.pm @@ -26,12 +26,23 @@ sub enqueue sub dequeue { my $conn = shift; - my $msg; - - while ($msg = shift @{$conn->{inqueue}}){ - $msg =~ s/\%([2-9A-F][0-9A-F])/chr(hex($1))/eg; - $msg =~ s/[\x00-\x08\x0a-\x1f\x80-\x9f]/./g; # immutable CSI sequence + control characters - &{$conn->{rproc}}($conn, $msg, $!); - $! = 0; + + if ($conn->{msg} =~ /\n/) { + my @lines = split /\r?\n/, $conn->{msg}; + if ($conn->{msg} =~ /\n$/) { + delete $conn->{msg}; + } else { + $conn->{msg} = pop @lines; + } + for (@lines) { + if (defined $_) { + s/\%([0-9A-F][0-9A-F])/chr(hex($1))/eg; + s/[\x00-\x08\x0a-\x1f\x80-\x9f]/./g; # immutable CSI sequence + control characters + } else { + $_ = ''; + } + &{$conn->{rproc}}($conn, $_); + } } } +