line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Find::Rule::DMIDecode; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
79577
|
use base qw(File::Find::Rule); |
|
4
|
|
|
|
|
25
|
|
|
4
|
|
|
|
|
1568
|
|
4
|
4
|
|
|
4
|
|
15212
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
75
|
|
5
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
109
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
2346
|
use List::MoreUtils qw(any); |
|
4
|
|
|
|
|
48636
|
|
|
4
|
|
|
|
|
20
|
|
8
|
4
|
|
|
4
|
|
5891
|
use Parse::DMIDecode; |
|
4
|
|
|
|
|
26670
|
|
|
4
|
|
|
|
|
2165
|
|
9
|
4
|
|
|
4
|
|
1920
|
use Perl6::Slurp; |
|
4
|
|
|
|
|
5932
|
|
|
4
|
|
|
|
|
3799
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = 0.03; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Detect dmidecode file. |
14
|
|
|
|
|
|
|
sub File::Find::Rule::dmidecode_file { |
15
|
1
|
|
|
1
|
0
|
251
|
my $file_find_rule = shift; |
16
|
1
|
|
|
|
|
5
|
my $self = $file_find_rule->_force_object; |
17
|
|
|
|
|
|
|
return $self->file->exec(sub{ |
18
|
1
|
|
|
1
|
|
883
|
my $file = shift; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
6
|
my $data = slurp($file); |
21
|
1
|
|
|
|
|
251
|
my $dmidecode = Parse::DMIDecode->new; |
22
|
1
|
|
|
|
|
141
|
$dmidecode->parse($data); |
23
|
|
|
|
|
|
|
|
24
|
1
|
50
|
|
|
|
34884
|
return $dmidecode->dmidecode_version ? 1 : 0; |
25
|
1
|
|
|
|
|
46
|
}); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub File::Find::Rule::dmidecode_handle { |
29
|
2
|
|
|
2
|
0
|
1263
|
my ($file_find_rule, $handle) = @_; |
30
|
2
|
|
|
|
|
8
|
my $self = $file_find_rule->_force_object; |
31
|
|
|
|
|
|
|
return $self->file->exec(sub{ |
32
|
2
|
|
|
2
|
|
1509
|
my $file = shift; |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
9
|
my $data = slurp($file); |
35
|
2
|
|
|
|
|
399
|
my $dmidecode = Parse::DMIDecode->new; |
36
|
2
|
|
|
|
|
229
|
$dmidecode->parse($data); |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
70136
|
return any { $_->handle eq $handle } $dmidecode->get_handles; |
|
63
|
|
|
|
|
2266
|
|
39
|
2
|
|
|
|
|
87
|
}); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |