line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::Find::Rule::DMIDecode; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
105574
|
use base qw(File::Find::Rule); |
|
5
|
|
|
|
|
35
|
|
|
5
|
|
|
|
|
1743
|
|
4
|
5
|
|
|
5
|
|
17326
|
use strict; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
101
|
|
5
|
5
|
|
|
5
|
|
26
|
use warnings; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
169
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
3200
|
use List::MoreUtils qw(any); |
|
5
|
|
|
|
|
70805
|
|
|
5
|
|
|
|
|
31
|
|
8
|
5
|
|
|
5
|
|
8165
|
use Parse::DMIDecode; |
|
5
|
|
|
|
|
39546
|
|
|
5
|
|
|
|
|
152
|
|
9
|
5
|
|
|
5
|
|
6612
|
use Perl6::Slurp; |
|
5
|
|
|
|
|
7954
|
|
|
5
|
|
|
|
|
32
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = 0.05; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Detect dmidecode file. |
14
|
|
|
|
|
|
|
sub File::Find::Rule::dmidecode_file { |
15
|
1
|
|
|
1
|
0
|
254
|
my $file_find_rule = shift; |
16
|
1
|
|
|
|
|
6
|
my $self = $file_find_rule->_force_object; |
17
|
|
|
|
|
|
|
return $self->file->exec(sub{ |
18
|
1
|
|
|
1
|
|
913
|
my $file = shift; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
6
|
my $data = slurp($file); |
21
|
1
|
|
|
|
|
229
|
my $dmidecode = Parse::DMIDecode->new; |
22
|
1
|
|
|
|
|
138
|
$dmidecode->parse($data); |
23
|
|
|
|
|
|
|
|
24
|
1
|
50
|
|
|
|
35660
|
return $dmidecode->dmidecode_version ? 1 : 0; |
25
|
1
|
|
|
|
|
63
|
}); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub File::Find::Rule::dmidecode_handle { |
29
|
2
|
|
|
2
|
0
|
1317
|
my ($file_find_rule, $handle) = @_; |
30
|
2
|
|
|
|
|
8
|
my $self = $file_find_rule->_force_object; |
31
|
|
|
|
|
|
|
return $self->file->exec(sub{ |
32
|
2
|
|
|
2
|
|
1777
|
my $file = shift; |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
16
|
my $data = slurp($file); |
35
|
2
|
|
|
|
|
466
|
my $dmidecode = Parse::DMIDecode->new; |
36
|
2
|
|
|
|
|
268
|
$dmidecode->parse($data); |
37
|
|
|
|
|
|
|
|
38
|
2
|
|
|
|
|
69593
|
return any { $_->handle eq $handle } $dmidecode->get_handles; |
|
63
|
|
|
|
|
2297
|
|
39
|
2
|
|
|
|
|
93
|
}); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub File::Find::Rule::dmidecode_type { |
43
|
2
|
|
|
2
|
0
|
3229
|
my ($file_find_rule, $dmi_type) = @_; |
44
|
2
|
|
|
|
|
10
|
my $self = $file_find_rule->_force_object; |
45
|
|
|
|
|
|
|
return $self->file->exec(sub{ |
46
|
2
|
|
|
2
|
|
1583
|
my $file = shift; |
47
|
|
|
|
|
|
|
|
48
|
2
|
|
|
|
|
19
|
my $data = slurp($file); |
49
|
2
|
|
|
|
|
421
|
my $dmidecode = Parse::DMIDecode->new; |
50
|
2
|
|
|
|
|
284
|
$dmidecode->parse($data); |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
|
|
|
69792
|
return $dmidecode->get_handles(dmitype => $dmi_type); |
53
|
2
|
|
|
|
|
90
|
}); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |