line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Find::Rule::DMIDecode; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
102120
|
use base qw(File::Find::Rule); |
|
5
|
|
|
|
|
35
|
|
|
5
|
|
|
|
|
1761
|
|
4
|
5
|
|
|
5
|
|
17146
|
use strict; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
101
|
|
5
|
5
|
|
|
5
|
|
26
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
185
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
3006
|
use List::MoreUtils qw(any); |
|
5
|
|
|
|
|
64722
|
|
|
5
|
|
|
|
|
33
|
|
8
|
5
|
|
|
5
|
|
7915
|
use Parse::DMIDecode; |
|
5
|
|
|
|
|
34979
|
|
|
5
|
|
|
|
|
2066
|
|
9
|
5
|
|
|
5
|
|
4433
|
use Perl6::Slurp; |
|
5
|
|
|
|
|
7823
|
|
|
5
|
|
|
|
|
3839
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = 0.04; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Detect dmidecode file. |
14
|
|
|
|
|
|
|
sub File::Find::Rule::dmidecode_file { |
15
|
1
|
|
|
1
|
0
|
252
|
my $file_find_rule = shift; |
16
|
1
|
|
|
|
|
7
|
my $self = $file_find_rule->_force_object; |
17
|
|
|
|
|
|
|
return $self->file->exec(sub{ |
18
|
1
|
|
|
1
|
|
888
|
my $file = shift; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
7
|
my $data = slurp($file); |
21
|
1
|
|
|
|
|
227
|
my $dmidecode = Parse::DMIDecode->new; |
22
|
1
|
|
|
|
|
145
|
$dmidecode->parse($data); |
23
|
|
|
|
|
|
|
|
24
|
1
|
50
|
|
|
|
35002
|
return $dmidecode->dmidecode_version ? 1 : 0; |
25
|
1
|
|
|
|
|
47
|
}); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub File::Find::Rule::dmidecode_handle { |
29
|
2
|
|
|
2
|
0
|
1458
|
my ($file_find_rule, $handle) = @_; |
30
|
2
|
|
|
|
|
12
|
my $self = $file_find_rule->_force_object; |
31
|
|
|
|
|
|
|
return $self->file->exec(sub{ |
32
|
2
|
|
|
2
|
|
1746
|
my $file = shift; |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
12
|
my $data = slurp($file); |
35
|
2
|
|
|
|
|
453
|
my $dmidecode = Parse::DMIDecode->new; |
36
|
2
|
|
|
|
|
308
|
$dmidecode->parse($data); |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
71686
|
return any { $_->handle eq $handle } $dmidecode->get_handles; |
|
63
|
|
|
|
|
2401
|
|
39
|
2
|
|
|
|
|
97
|
}); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub File::Find::Rule::dmidecode_type { |
43
|
2
|
|
|
2
|
0
|
3247
|
my ($file_find_rule, $dmi_type) = @_; |
44
|
2
|
|
|
|
|
9
|
my $self = $file_find_rule->_force_object; |
45
|
|
|
|
|
|
|
return $self->file->exec(sub{ |
46
|
2
|
|
|
2
|
|
1545
|
my $file = shift; |
47
|
|
|
|
|
|
|
|
48
|
2
|
|
|
|
|
10
|
my $data = slurp($file); |
49
|
2
|
|
|
|
|
414
|
my $dmidecode = Parse::DMIDecode->new; |
50
|
2
|
|
|
|
|
251
|
$dmidecode->parse($data); |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
|
|
|
70159
|
return $dmidecode->get_handles(dmitype => $dmi_type); |
53
|
2
|
|
|
|
|
83
|
}); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |