| 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
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table0%0/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||
| 20 | 0 | $self->{quiet} = ${$params}{Quiet}; | |||||||||||||||||||
| 21 | 0 | ▶ | $self->{port} = ${$params}{Port} || 1024; | ||||||||||||||||||
|
Condition0%0/2
do {
$params
}->{'Port'} || 1024
MC/DC0%0/1
do {
$params
}->{'Port'} || 1024
do {
$params
}->{'Port'}
Truth table0%0/2
A
A= do {
$params
}->{'Port'}
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 0 | syswrite($self->{sock}, $msg_frm, length($msg_frm)); | |||||||||||||||||||
| 47 | } | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | |||||||||||||||||||||
| 50 | 1 | 1; | |||||||||||||||||||
| 51 | __END__ | ||||||||||||||||||||