line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FUSE::Client; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require 5; |
4
|
1
|
|
|
1
|
|
1093
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use vars qw($VERSION @ISA @EXPORT); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
271
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
1363
|
use IO::Socket; |
|
1
|
|
|
|
|
45733
|
|
|
1
|
|
|
|
|
4
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
require Exporter; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
13
|
|
|
|
|
|
|
@EXPORT = qw(); |
14
|
|
|
|
|
|
|
$VERSION = '1.08'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
0
|
|
|
0
|
1
|
|
my ($class,$params) = @_; |
18
|
0
|
|
|
|
|
|
my $self = {}; |
19
|
0
|
|
0
|
|
|
|
bless $self,ref $class || $class; |
20
|
0
|
|
|
|
|
|
$self->{quiet} = ${$params}{Quiet}; |
|
0
|
|
|
|
|
|
|
21
|
0
|
|
0
|
|
|
|
$self->{port} = ${$params}{Port} || 1024; |
22
|
0
|
|
|
|
|
|
$self->{sock} = 0; |
23
|
0
|
|
|
|
|
|
return $self; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub connect { |
27
|
0
|
|
|
0
|
1
|
|
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
|
0
|
|
|
|
|
die "Could not create socket: $!\n" unless $self->{sock}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub disconnect { |
34
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
35
|
0
|
|
|
|
|
|
close($self->{sock}); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub send { |
39
|
0
|
|
|
0
|
1
|
|
my ($self,$msg,$params) = @_; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
$msg = "$msg $params"; |
42
|
0
|
|
|
|
|
|
my $msg_frm = sprintf("%04d%s",length($msg),$msg); |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
print "sending $msg_frm\n" unless $self->{Quiet}; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
syswrite($self->{sock}, $msg_frm, length($msg_frm)); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
__END__ |