line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
1150
|
use 5.008; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
37
|
|
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package once; |
6
|
|
|
|
|
|
|
BEGIN { |
7
|
1
|
|
|
1
|
|
19
|
$once::VERSION = '1.101420'; |
8
|
|
|
|
|
|
|
} |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Execute code only once throughout the program's lifetime |
11
|
1
|
|
|
1
|
|
5
|
use Exporter qw(import); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
138
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw(ONCE); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub ONCE (&) { |
15
|
48
|
|
|
48
|
1
|
656
|
my $code = shift; |
16
|
48
|
|
|
|
|
52
|
our %seen; |
17
|
48
|
|
|
|
|
168
|
my ($package, $filename, $line) = caller; |
18
|
48
|
100
|
|
|
|
210
|
unless ($seen{"ONCE $package $filename $line"}++) { |
19
|
4
|
|
|
|
|
10
|
$code->(); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
1; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__END__ |