blib/lib/FUSE/Client.pm

filter: Statementstmt 42.8% 15 / 35 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 42.8% 3 / 7 Podpod 100% 4 / 4 totaltotal 37.9% 22 / 58 CC 5 SCAR 17.8
CC
5
Cov
34%
new
12.0
connect
6.0
send
6.0
CRAP 5.9
↑ Summary
1 package FUSE::Client;
2  
3 1 require 5;
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use vars qw($VERSION @ISA @EXPORT);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use IO::Socket;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 require Exporter;
11  
12 1 @ISA = qw(Exporter);
13 1 @EXPORT = qw();
14 1 $VERSION = '1.08';
15  
16 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
17 0 my ($class,$params) = @_;
18 0 my $self = {};
19 0 ▶ bless $self,ref $class || $class;
Condition0%0/3
ref $class || $class
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table0%0/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
20 0 $self->{quiet} = ${$params}{Quiet};
21 0 ▶ $self->{port} = ${$params}{Port} || 1024;
Condition0%0/2
do { $params }->{'Port'} || 1024
l!l
00
MC/DC0%0/1
do { $params }->{'Port'} || 1024
do { $params }->{'Port'}
Truth table0%0/2
A
A= do { $params }->{'Port'}
Aresult
11
00
22 0 $self->{sock} = 0;
23 0 return $self;
24 }
25  
26 0 ▶sub connect {
Subroutine connect: not called CC=2 SCAR=17.9
Pod documented
27 0 my ($self,$host) = @_;
28 0 $self->{sock} = new IO::Socket::INET ( PeerAddr => $host, PeerPort => $self->{port}, Proto => 'tcp' );
29 0 $self->{sock}->autoflush(1);
30 0 ▶ die "Could not create socket: $!\n" unless $self->{sock};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"sock"} 0 0 0
31 }
32  
33 0 ▶sub disconnect {
Subroutine disconnect: not called CC=1 SCAR=6.9
Pod documented
34 0 my ($self) = @_;
35 0 close($self->{sock});
36 }
37  
38 0 ▶sub send {
Subroutine send: not called CC=2 SCAR=17.9
Pod documented
39 0 my ($self,$msg,$params) = @_;
40  
41 0 $msg = "$msg $params";
42 0 my $msg_frm = sprintf("%04d%s",length($msg),$msg);
43  
44 0 ▶ print "sending $msg_frm\n" unless $self->{Quiet};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"Quiet"} 0 0 0
45  
46 0 syswrite($self->{sock}, $msg_frm, length($msg_frm));
47 }
48  
49  
50 1 1;
51 __END__
↑ Summary