line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::FSP::Handle::Write; |
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
39
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
4
|
|
|
|
|
|
|
our $VERSION = $Net::FSP::VERSION; |
5
|
1
|
|
|
1
|
|
5
|
use Net::FSP::Handle qw/do_or_fail/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
41
|
|
6
|
1
|
|
|
1
|
|
4
|
use base 'Net::FSP::Handle'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
407
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub OPEN { |
9
|
0
|
|
|
0
|
|
|
my ($self, $mode, $filename) = @_; |
10
|
0
|
0
|
|
|
|
|
$self->CLOSE if keys %{$self} > 1; |
|
0
|
|
|
|
|
|
|
11
|
0
|
|
|
|
|
|
$self->{writer} = $self->{fsp}->_get_writer($filename); |
12
|
0
|
|
|
|
|
|
return $self; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub PRINT { |
16
|
0
|
|
|
0
|
|
|
my ($self, @args) = @_; |
17
|
0
|
0
|
|
|
|
|
my $separator = defined $, ? $, : ''; |
18
|
0
|
|
|
|
|
|
my $buffer = join $separator, @args; |
19
|
0
|
|
|
|
|
|
return $self->WRITE($buffer, length $buffer, 0); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub PRINTF { |
23
|
0
|
|
|
0
|
|
|
my ($self, @args) = @_; |
24
|
0
|
|
|
|
|
|
my $buffer = sprintf shift, @args; |
25
|
0
|
|
|
|
|
|
return $self->WRITE($buffer, length $buffer, 0); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub WRITE { |
29
|
0
|
|
|
0
|
|
|
my ($self, $buffer, $length, $offset) = @_; |
30
|
|
|
|
|
|
|
return do_or_fail { |
31
|
0
|
|
|
0
|
|
|
$self->{writer}->(substr $buffer, $offset, $length); |
32
|
0
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub EOF { |
36
|
0
|
|
|
0
|
|
|
return 0; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub CLOSE { |
40
|
0
|
|
|
0
|
|
|
my $self = shift; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my $ret = do_or_fail { |
43
|
0
|
0
|
|
0
|
|
|
$self->{writer}->(undef) if defined $self->{writer}; |
44
|
0
|
|
|
|
|
|
}; |
45
|
0
|
|
|
|
|
|
$self->SUPER::CLOSE; |
46
|
0
|
|
|
|
|
|
return $ret; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |