Subject: | Non-Blocking support |
At least X11::Connection::Socket don't support non-blocking
filedescriptors on the X11 handle. If you want ot use X11::Protocoll in
POE or any other select() and nonblocking environment this currently
isn't possible.
A short workaround patch for nonblocking reading is attached, but better
it would be to have callback handlers to be able to call if the
filedescript has data or if X11::Protocol wants to write data. If
X11::Protocol blocks on writing the process is still blocking, so this
need more work to fully support nonblocking processing.
Subject: | Socket.pm.diff |
--- /usr/share/perl5/X11/Protocol/Connection/Socket.pm.org 2011-12-03 16:18:11.000000000 +0100
+++ /usr/share/perl5/X11/Protocol/Connection/Socket.pm 2011-12-03 17:27:12.000000000 +0100
@@ -18,11 +18,13 @@
sub give {
my($self) = shift;
my($msg) = @_;
my($sock) = $$self;
+ my $isblocking = $sock->blocking(1);
$sock->write($msg, length($msg)) or croak $!;
+ $sock->blocking($isblocking);
}
sub get {
my($self) = shift;
my($len) = @_;
@@ -42,11 +44,13 @@
}
sub flush {
my($self) = shift;
my($sock) = $$self;
+ my $isblocking = $sock->blocking(1);
$sock->flush;
+ $sock->blocking($isblocking);
}
1;
__END__