line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Linux::TempFile; |
2
|
2
|
|
|
2
|
|
25172
|
use 5.008001; |
|
2
|
|
|
|
|
10
|
|
3
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
61
|
|
4
|
2
|
|
|
2
|
|
28
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
83
|
|
5
|
2
|
|
|
2
|
|
12
|
use base 'IO::Handle'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
2634
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = "0.02"; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
require XSLoader; |
10
|
|
|
|
|
|
|
XSLoader::load('Linux::TempFile', $VERSION); |
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
21265
|
use Carp (); |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
41
|
|
13
|
2
|
|
|
2
|
|
13
|
use File::Spec; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
382
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
1
|
|
|
1
|
1
|
13
|
my ($class, $dir) = @_; |
17
|
1
|
50
|
|
|
|
97
|
$dir = File::Spec->tmpdir unless defined $dir; |
18
|
1
|
|
|
|
|
224
|
my $fd = _open_tmpfile($dir); |
19
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new(); |
20
|
0
|
|
|
|
|
|
$self->fdopen($fd, '+>'); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub link { |
24
|
0
|
|
|
0
|
1
|
|
my ($self, $newpath) = @_; |
25
|
0
|
0
|
|
|
|
|
Carp::croak("path required") unless length $newpath; |
26
|
0
|
|
|
|
|
|
my $oldpath = '/proc/self/fd/' . fileno $self; |
27
|
0
|
|
|
|
|
|
_linkat($oldpath => $newpath); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
__END__ |