line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Lock::File::Alarm; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Lock::File::Alarm::VERSION = '1.03'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
21
|
|
|
21
|
|
86
|
use strict; |
|
21
|
|
|
|
|
40
|
|
|
21
|
|
|
|
|
579
|
|
7
|
21
|
|
|
21
|
|
103
|
use warnings; |
|
21
|
|
|
|
|
42
|
|
|
21
|
|
|
|
|
3779
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: alarm guard |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new ($$) { |
13
|
55
|
|
|
55
|
1
|
364
|
my ($class, $timeout) = @_; |
14
|
55
|
|
|
|
|
878
|
bless { 'alarm' => alarm($timeout), 'time' => time }; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub DESTROY ($) { |
18
|
55
|
|
|
55
|
|
26731
|
my $self = shift; |
19
|
55
|
|
|
|
|
146
|
local $@; |
20
|
55
|
|
|
|
|
92
|
my $alarm; |
21
|
55
|
100
|
|
|
|
641
|
if ($self->{alarm}) { |
22
|
53
|
|
|
|
|
248
|
$alarm = $self->{alarm} + $self->{time} - time; |
23
|
53
|
100
|
|
|
|
283
|
$alarm = 1 if $alarm <= 0; |
24
|
|
|
|
|
|
|
} else { |
25
|
2
|
|
|
|
|
20
|
$alarm = 0; |
26
|
|
|
|
|
|
|
} |
27
|
55
|
|
|
|
|
171788
|
alarm($alarm); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__ |