Protocol/Connection/Socket.pm

filter: Statementstmt 50.0% 18 / 36 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 55.5% 5 / 9 Podpod 75.0% 3 / 4 totaltotal 47.2% 26 / 55 CC 4 SCAR 15.6
CC
4
Cov
43%
get
12.0
give
6.0
fh
2.0
CRAP 4.8
« Protocol/Ext/SHAPE.pm ↑ Summary Protocol/Ext/XC_MISC.pm »
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 ▶use IO::Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use vars '$VERSION', '@ISA';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 ▶use X11::Protocol::Connection;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 @ISA = ('X11::Protocol::Connection');
16  
17 1 $VERSION = 0.02;
18  
19 0 ▶sub give {
Subroutine give: not called CC=2 SCAR=17.9
Pod documented
20 0 my($self) = shift;
21 0 my($msg) = @_;
22 0 my($sock) = $$self;
23 0 ▶ $sock->write($msg, length($msg)) or croak $!;
Branch: 1 branch
BranchTrueFalseTotal
$sock->write($msg, length $msg) or croak($!) 0 0 0
24 }
25  
26 0 ▶sub get {
Subroutine get: not called CC=3 SCAR=24.8
Pod documented
27 0 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) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($o == $len) 0 0 0
32 0 $n = $sock->sysread($x, $len - $o, $o);
33 0 ▶ croak $! unless defined $n;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $n 0 0 0
34 0 $o += $n;
35 }
36 0 return $x;
37 }
38  
39 0 ▶sub fh {
Subroutine fh: not called CC=1 SCAR=6.9
Pod documented
40 0 my($self) = shift;
41 0 return $$self;
42 }
43  
44 0 ▶sub flush {
Subroutine flush: not called CC=1 SCAR=6.9
Pod undocumented
45 0 my($self) = shift;
46 0 my($sock) = $$self;
47 0 $sock->flush;
48 }
49  
50 1 1;
51 __END__
« Protocol/Ext/SHAPE.pm ↑ Summary Protocol/Ext/XC_MISC.pm »