line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::cdif::Tmpfile; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
867
|
use v5.14; |
|
2
|
|
|
|
|
7
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
5
|
2
|
|
|
2
|
|
11
|
use utf8; |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
10
|
|
6
|
2
|
|
|
2
|
|
55
|
use Carp; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
106
|
|
7
|
2
|
|
|
2
|
|
11
|
use Fcntl; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
427
|
|
8
|
2
|
|
|
2
|
|
14
|
use IO::File; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
314
|
|
9
|
2
|
|
|
2
|
|
16
|
use IO::Handle; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
868
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
13
|
0
|
0
|
|
|
|
|
my $fh = new_tmpfile IO::File or die "new_tmpfile: $!\n"; |
14
|
0
|
0
|
|
|
|
|
$fh->fcntl(F_SETFD, 0) or die "fcntl F_SETFD: $!\n"; |
15
|
0
|
|
|
|
|
|
binmode $fh, ':encoding(utf8)'; |
16
|
0
|
|
|
|
|
|
bless { FH => $fh }, $class; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub write { |
20
|
0
|
|
|
0
|
0
|
|
my $obj = shift; |
21
|
0
|
|
|
|
|
|
my $fh = $obj->fh; |
22
|
0
|
0
|
|
|
|
|
if (@_) { |
23
|
0
|
|
|
|
|
|
my $data = join '', @_; |
24
|
0
|
|
|
|
|
|
$fh->print($data); |
25
|
|
|
|
|
|
|
} |
26
|
0
|
|
|
|
|
|
$obj; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub flush { |
30
|
0
|
|
|
0
|
0
|
|
my $obj = shift; |
31
|
0
|
|
|
|
|
|
$obj->fh->flush; |
32
|
0
|
|
|
|
|
|
$obj; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub rewind { |
36
|
0
|
|
|
0
|
0
|
|
my $obj = shift; |
37
|
0
|
0
|
|
|
|
|
$obj->fh->seek(0, 0) or die; |
38
|
0
|
|
|
|
|
|
$obj; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub reset { |
42
|
0
|
|
|
0
|
0
|
|
my $obj = shift; |
43
|
0
|
|
|
|
|
|
$obj->rewind; |
44
|
0
|
|
|
|
|
|
$obj->fh->truncate(0); |
45
|
0
|
|
|
|
|
|
$obj; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub fh { |
49
|
0
|
|
|
0
|
0
|
|
my $obj = shift; |
50
|
0
|
|
|
|
|
|
$obj->{FH}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub fd { |
54
|
0
|
|
|
0
|
0
|
|
my $obj = shift; |
55
|
0
|
|
|
|
|
|
$obj->fh->fileno; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub path { |
59
|
0
|
|
|
0
|
0
|
|
my $obj = shift; |
60
|
0
|
|
|
|
|
|
sprintf "/dev/fd/%d", $obj->fd; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |