line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Mock::Alarm; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
107367
|
use strict; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
114
|
|
4
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
66
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
10
|
use Exporter; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
273
|
|
7
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw(set_alarm restore_alarm); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
BEGIN { |
11
|
2
|
|
|
2
|
|
6
|
our $VERSION = '0.13'; |
12
|
2
|
|
|
|
|
328
|
*CORE::GLOBAL::alarm = \&Test::Mock::Alarm::mocked_alarm; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $_alarm; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub mocked_alarm { |
18
|
2
|
100
|
66
|
2
|
1
|
126
|
if ( defined $_alarm && ref($_alarm) eq 'CODE' ) { |
19
|
1
|
|
|
|
|
5
|
return $_alarm->(shift); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
else { |
22
|
1
|
|
|
|
|
26
|
return CORE::alarm(shift); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub set_alarm { |
27
|
1
|
|
|
1
|
1
|
15
|
$_alarm = shift; |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
2
|
return; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub restore_alarm { |
33
|
1
|
|
|
1
|
1
|
1485
|
undef $_alarm; |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
7
|
return; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |