line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
205008
|
use strict; |
|
5
|
|
|
|
|
39
|
|
|
5
|
|
|
|
|
148
|
|
2
|
5
|
|
|
5
|
|
26
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
448
|
|
3
|
|
|
|
|
|
|
package Device::CurrentCost::Constants; |
4
|
|
|
|
|
|
|
$Device::CurrentCost::Constants::VERSION = '1.232151'; |
5
|
|
|
|
|
|
|
# ABSTRACT: Module to export constants for Current Cost devices |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my %constants = |
9
|
|
|
|
|
|
|
( |
10
|
|
|
|
|
|
|
CURRENT_COST_CLASSIC => 0x1, |
11
|
|
|
|
|
|
|
CURRENT_COST_ENVY => 0x2, |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
my %names = |
14
|
|
|
|
|
|
|
( |
15
|
|
|
|
|
|
|
$constants{CURRENT_COST_ENVY} => 'Envy', |
16
|
|
|
|
|
|
|
$constants{CURRENT_COST_CLASSIC} => 'Classic', |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub import { |
20
|
5
|
|
|
5
|
|
34
|
no strict qw/refs/; ## no critic |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
946
|
|
21
|
13
|
|
|
13
|
|
62
|
my $pkg = caller(0); |
22
|
13
|
|
|
|
|
130
|
foreach (keys %constants) { |
23
|
26
|
|
|
|
|
60
|
my $v = $constants{$_}; |
24
|
26
|
|
|
0
|
|
175
|
*{$pkg.'::'.$_} = sub () { $v }; |
|
26
|
|
|
|
|
154
|
|
|
0
|
|
|
|
|
0
|
|
25
|
|
|
|
|
|
|
} |
26
|
13
|
|
|
|
|
37
|
foreach (qw/current_cost_type_string/) { |
27
|
13
|
|
|
|
|
17
|
*{$pkg.'::'.$_} = \&{$_}; |
|
13
|
|
|
|
|
336
|
|
|
13
|
|
|
|
|
32
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub current_cost_type_string { |
33
|
3
|
|
|
3
|
1
|
16
|
$names{$_[0]} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |