line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::FSP::Handle; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
5
|
1
|
|
|
1
|
|
4
|
use base 'Exporter'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
79
|
|
6
|
|
|
|
|
|
|
our $VERSION = $Net::FSP::VERSION; |
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw/do_or_fail/; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
10
|
1
|
|
|
1
|
|
5
|
use Errno qw/EIO/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
304
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
require Net::FSP::Handle::Read; |
13
|
|
|
|
|
|
|
require Net::FSP::Handle::Write; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my %class_for = ( |
16
|
|
|
|
|
|
|
'<' => 'Net::FSP::Handle::Read', |
17
|
|
|
|
|
|
|
'>' => 'Net::FSP::Handle::Write', |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub do_or_fail(&) { ##no critic prototype |
21
|
0
|
|
|
0
|
1
|
|
my $action = shift; |
22
|
0
|
|
|
|
|
|
local $@; |
23
|
0
|
|
|
|
|
|
my $ret; |
24
|
0
|
|
|
|
|
|
eval { $ret = $action->(); }; |
|
0
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
if ($@) { |
26
|
0
|
|
|
|
|
|
$! = EIO; |
27
|
0
|
|
|
|
|
|
return; |
28
|
|
|
|
|
|
|
} |
29
|
0
|
|
|
|
|
|
return $ret; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub TIEHANDLE { |
33
|
0
|
|
|
0
|
|
|
my (undef, $fsp, $filename, $mode) = @_; |
34
|
0
|
0
|
|
|
|
|
my $class = $class_for{$mode} or croak "Invalid or unsuppored mode specified\n"; |
35
|
0
|
|
|
|
|
|
my $self = bless { fsp => $fsp }, $class; |
36
|
0
|
|
|
|
|
|
$self->OPEN($mode, $filename); |
37
|
0
|
|
|
|
|
|
return $self; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub CLOSE { |
41
|
0
|
|
|
0
|
|
|
my $self = shift; |
42
|
0
|
|
|
|
|
|
for my $key (keys %{$self}) { |
|
0
|
|
|
|
|
|
|
43
|
0
|
0
|
|
|
|
|
delete $self->{$key} if $key ne 'fsp'; |
44
|
|
|
|
|
|
|
} |
45
|
0
|
|
|
|
|
|
return 1; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub DESTROY { |
49
|
0
|
|
|
0
|
|
|
my $self = shift; |
50
|
0
|
|
|
|
|
|
$self->CLOSE; |
51
|
0
|
|
|
|
|
|
return; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |