line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package X11::Protocol::Connection::Socket; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# Copyright (C) 1997, 1999, 2003 Stephen McCamant. All rights |
6
|
|
|
|
|
|
|
# reserved. This program is free software; you can redistribute and/or |
7
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
977
|
use IO::Socket; |
|
1
|
|
|
|
|
26064
|
|
|
1
|
|
|
|
|
5
|
|
10
|
1
|
|
|
1
|
|
718
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
56
|
|
11
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
12
|
1
|
|
|
1
|
|
5
|
use vars '$VERSION', '@ISA'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
696
|
use X11::Protocol::Connection; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
253
|
|
15
|
|
|
|
|
|
|
@ISA = ('X11::Protocol::Connection'); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$VERSION = 0.02; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub give { |
20
|
0
|
|
|
0
|
1
|
|
my($self) = shift; |
21
|
0
|
|
|
|
|
|
my($msg) = @_; |
22
|
0
|
|
|
|
|
|
my($sock) = $$self; |
23
|
0
|
0
|
|
|
|
|
$sock->write($msg, length($msg)) or croak $!; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub get { |
27
|
0
|
|
|
0
|
1
|
|
my($self) = shift; |
28
|
0
|
|
|
|
|
|
my($len) = @_; |
29
|
0
|
|
|
|
|
|
my($x, $n, $o) = ("", 0, 0); |
30
|
0
|
|
|
|
|
|
my($sock) = $$self; |
31
|
0
|
|
|
|
|
|
until ($o == $len) { |
32
|
0
|
|
|
|
|
|
$n = $sock->sysread($x, $len - $o, $o); |
33
|
0
|
0
|
|
|
|
|
croak $! unless defined $n; |
34
|
0
|
|
|
|
|
|
$o += $n; |
35
|
|
|
|
|
|
|
} |
36
|
0
|
|
|
|
|
|
return $x; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub fh { |
40
|
0
|
|
|
0
|
1
|
|
my($self) = shift; |
41
|
0
|
|
|
|
|
|
return $$self; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub flush { |
45
|
0
|
|
|
0
|
0
|
|
my($self) = shift; |
46
|
0
|
|
|
|
|
|
my($sock) = $$self; |
47
|
0
|
|
|
|
|
|
$sock->flush; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
__END__ |