/usr/local/lib/perl5/5.44.0/x86_64-linux/IO/Socket/UNIX.pm

filter: Statementstmt 36.1% 13 / 36 Branchbran 0.0% 0 / 24 Conditioncond 0.0% 0 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 42.8% 3 / 7 Podpod 75.0% 3 / 4 totaltotal 21.5% 19 / 88 CC 18 SCAR 46.3
CC
18
Cov
18%
configure
182.0
hostpath
12.0
peerpath
12.0
CRAP 102.2
« /usr/local/lib/perl5/5.44.0/x86_64-linux/Digest/SHA.pm ↑ Summary /usr/local/lib/perl5/5.44.0/x86_64-linux/Storable.pm »
1 # IO::Socket::UNIX.pm
2 #
3 # Copyright (c) 1997-8 Graham Barr <gbarr@pobox.com>. All rights reserved.
4 # This program is free software; you can redistribute it and/or
5 # modify it under the same terms as Perl itself.
6  
7 package IO::Socket::UNIX;
8  
9 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 ▶use IO::Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 5 our @ISA = qw(IO::Socket);
14 5 our $VERSION = "1.56";
15  
16 5 IO::Socket::UNIX->register_domain( AF_UNIX );
17  
18 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
19 0 my $class = shift;
20 0 ▶ unshift(@_, "Peer") if @_ == 1;
Branch: 1 branch
BranchTrueFalseTotal
if @_ == 1 0 0 0
21 0 return $class->SUPER::new(@_);
22 }
23  
24 0 ▶sub configure {
Subroutine configure: not called CC=13 SCAR=52.0
Pod undocumented
25 0 my($sock,$arg) = @_;
26 0 my($bport,$cport);
27  
28 0 ▶ my $type = $arg->{Type} || SOCK_STREAM;
Condition0%0/2
$arg->{'Type'} || 1
l!l
00
MC/DC0%0/1
$arg->{'Type'} || 1
$arg->{'Type'}
Truth table0%0/2
A
A= $arg->{'Type'}
Aresult
11
00
29  
30 0 ▶ $sock->socket(AF_UNIX, $type, 0) or
Branch: 1 branch
BranchTrueFalseTotal
$sock->socket(1, $type, 0) or return undef 0 0 0
31 return undef;
32  
33 0 ▶ if(exists $arg->{Blocking}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $arg->{"Blocking"}) 0 0 0
34 0 ▶ $sock->blocking($arg->{Blocking}) or
Branch: 1 branch
BranchTrueFalseTotal
$sock->blocking($arg->{"Blocking"}) or return undef 0 0 0
35 return undef;
36 }
37 0 ▶ if(exists $arg->{Local}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $arg->{"Local"}) 0 0 0
38 0 my $addr = sockaddr_un($arg->{Local});
39 0 ▶ $sock->bind($addr) or
Branch: 1 branch
BranchTrueFalseTotal
$sock->bind($addr) or return undef 0 0 0
40 return undef;
41 }
42 0 ▶ if(exists $arg->{Listen} && $type != SOCK_DGRAM) {
Branch: 2 branches
BranchTrueFalseTotal
if (exists $arg->{'Listen'} and $type != 2) { } 0 0 0
elsif (exists $arg->{'Peer'}) { } 0 0 0
Condition0%0/3
exists $arg->{"Listen"} and $type != 2
!ll&&!rl&&r
000
MC/DC0%0/2
exists $arg->{"Listen"} and $type != 2
exists $arg->{"Listen"} $type != 2
Truth table0%0/3
A and B
A= exists $arg->{"Listen"}B= $type != 2
ABresult
0X0
100
111
43 0 ▶ $sock->listen($arg->{Listen} || 5) or
Branch: 1 branch
BranchTrueFalseTotal
$sock->listen($arg->{"Listen"} || 5) or return undef 0 0 0
Condition0%0/2
$arg->{'Listen'} || 5
l!l
00
MC/DC0%0/1
$arg->{'Listen'} || 5
$arg->{'Listen'}
Truth table0%0/2
A
A= $arg->{'Listen'}
Aresult
11
00
44 return undef;
45 }
46 elsif(exists $arg->{Peer}) {
47 0 my $addr = sockaddr_un($arg->{Peer});
48 0 ▶ $sock->connect($addr) or
Branch: 1 branch
BranchTrueFalseTotal
$sock->connect($addr) or return undef 0 0 0
49 return undef;
50 }
51  
52 0 $sock;
53 }
54  
55 0 ▶sub hostpath {
Subroutine hostpath: not called CC=3 SCAR=24.8
Pod documented
56 0 ▶ @_ == 1 or croak 'usage: $sock->hostpath()';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("usage: \$sock->hostpath()") 0 0 0
57 0 ▶ my $n = $_[0]->sockname || return undef;
Condition0%0/2
$_[0]->sockname || (return undef)
l!l
00
MC/DC0%0/1
$_[0]->sockname || (return undef)
$_[0]->sockname
Truth table0%0/2
A
A= $_[0]->sockname
Aresult
11
00
58 0 (sockaddr_un($n))[0];
59 }
60  
61 0 ▶sub peerpath {
Subroutine peerpath: not called CC=3 SCAR=24.8
Pod documented
62 0 ▶ @_ == 1 or croak 'usage: $sock->peerpath()';
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 or croak("usage: \$sock->peerpath()") 0 0 0
63 0 ▶ my $n = $_[0]->peername || return undef;
Condition0%0/2
$_[0]->peername || (return undef)
l!l
00
MC/DC0%0/1
$_[0]->peername || (return undef)
$_[0]->peername
Truth table0%0/2
A
A= $_[0]->peername
Aresult
11
00
64 0 (sockaddr_un($n))[0];
65 }
66  
67 5 1; # Keep require happy
68  
69 __END__
« /usr/local/lib/perl5/5.44.0/x86_64-linux/Digest/SHA.pm ↑ Summary /usr/local/lib/perl5/5.44.0/x86_64-linux/Storable.pm »