line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Storage::Stat; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
38767
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
116
|
|
4
|
3
|
|
|
3
|
|
15
|
use Carp; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
1834
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Exporter; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
9
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
2
|
|
|
2
|
0
|
26
|
my $class = shift; |
13
|
2
|
|
|
|
|
4
|
my $options = shift; |
14
|
|
|
|
|
|
|
|
15
|
2
|
50
|
|
|
|
8
|
croak('FilePath is not set.') |
16
|
|
|
|
|
|
|
unless $options->{FilePath}; |
17
|
|
|
|
|
|
|
|
18
|
2
|
50
|
|
|
|
40
|
croak('Ther is no (' . $options->{FilePath} . ').') |
19
|
|
|
|
|
|
|
unless -e $options->{FilePath}; |
20
|
|
|
|
|
|
|
|
21
|
2
|
100
|
|
|
|
6
|
if ($options->{Type}) { |
22
|
1
|
50
|
|
|
|
5
|
$options->{Type} ='int' |
23
|
|
|
|
|
|
|
unless $options->{Type} eq 'char'; |
24
|
|
|
|
|
|
|
} else { |
25
|
1
|
|
|
|
|
3
|
$options->{Type} = 'int'; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
2
|
|
|
|
|
7
|
my $self = { |
29
|
|
|
|
|
|
|
FilePath => $options->{FilePath}, |
30
|
|
|
|
|
|
|
Type => $options->{Type}, |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
|
33
|
2
|
|
|
|
|
7
|
return bless $self, $class; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub set { |
37
|
48
|
|
|
48
|
1
|
15707
|
my $self = shift; |
38
|
48
|
|
|
|
|
100
|
my @times = (shift, shift); |
39
|
|
|
|
|
|
|
|
40
|
48
|
100
|
|
|
|
136
|
if ($self->{Type} eq 'char') { |
41
|
5
|
|
|
|
|
11
|
foreach (0...1) { |
42
|
10
|
100
|
|
|
|
24
|
if (length($times[$_]) > 4) { |
43
|
2
|
|
|
|
|
7
|
$times[$_] = 0; |
44
|
|
|
|
|
|
|
} else { |
45
|
8
|
|
|
|
|
10
|
my $t = 0; |
46
|
8
|
|
|
|
|
27
|
foreach (split('', $times[$_])) { |
47
|
18
|
|
|
|
|
21
|
$t <<= 8; |
48
|
18
|
|
|
|
|
28
|
$t += ord($_); |
49
|
|
|
|
|
|
|
} |
50
|
8
|
|
|
|
|
24
|
$times[$_] = $t; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
96
|
|
|
|
|
95
|
@times = map { |
56
|
48
|
|
|
|
|
69
|
my $v = $_; |
57
|
96
|
100
|
|
|
|
228
|
if ($v < 0) { |
|
|
100
|
|
|
|
|
|
58
|
1
|
|
|
|
|
2
|
$v = 0; |
59
|
|
|
|
|
|
|
} elsif ($v >= ((1 << 31) * 2)) { |
60
|
1
|
|
|
|
|
2
|
$v = 0; |
61
|
|
|
|
|
|
|
} |
62
|
96
|
|
|
|
|
184
|
$v; |
63
|
|
|
|
|
|
|
} @times; |
64
|
|
|
|
|
|
|
|
65
|
48
|
|
|
|
|
1063
|
return utime($times[0], $times[1], $self->{FilePath}); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub get { |
69
|
48
|
|
|
48
|
1
|
168
|
my $self = shift; |
70
|
|
|
|
|
|
|
|
71
|
144
|
|
|
|
|
157
|
my @times = map { |
72
|
48
|
|
|
|
|
596
|
my $v = $_; |
73
|
144
|
50
|
|
|
|
251
|
if ($v < 0) { |
74
|
0
|
|
|
|
|
0
|
$v = $v + ((1 << 31) * 2); |
75
|
|
|
|
|
|
|
} |
76
|
144
|
|
|
|
|
237
|
$v; |
77
|
|
|
|
|
|
|
} (stat $self->{FilePath})[8,9,10]; |
78
|
|
|
|
|
|
|
|
79
|
48
|
100
|
|
|
|
127
|
if ($self->{Type} eq 'char') { |
80
|
5
|
|
|
|
|
10
|
foreach (0...1) { |
81
|
10
|
100
|
|
|
|
20
|
if ($times[$_]) { |
82
|
6
|
|
|
|
|
13
|
my $t = ''; |
83
|
6
|
|
|
|
|
7
|
while (1) { |
84
|
18
|
|
|
|
|
36
|
$t = chr($times[$_] % 256) . $t; |
85
|
18
|
|
|
|
|
28
|
$times[$_] >>= 8; |
86
|
18
|
100
|
|
|
|
39
|
last unless $times[$_]; |
87
|
|
|
|
|
|
|
} |
88
|
6
|
|
|
|
|
17
|
$times[$_] = $t; |
89
|
|
|
|
|
|
|
} else { |
90
|
4
|
|
|
|
|
8
|
$times[$_] = ''; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
48
|
|
|
|
|
135
|
return @times; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; |
99
|
|
|
|
|
|
|
__END__ |