| 1 | package File::Find::Rule::DMIDecode; | ||
| 2 | |||
| 3 | 3 | ▶ | use base qw(File::Find::Rule); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 3 | ▶ | use Perl6::Slurp; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 8 | use Parse::DMIDecode; | ||
| 9 | |||
| 10 | our $VERSION = 0.01; | ||
| 11 | |||
| 12 | # Detect dmidecode file. | ||
| 13 | sub File::Find::Rule::dmidecode_file { | ||
| 14 | my $file_find_rule = shift; | ||
| 15 | my $self = $file_find_rule->_force_object; | ||
| 16 | return $self->file->exec(sub{ | ||
| 17 | my $file = shift; | ||
| 18 | |||
| 19 | my $data = slurp($file); | ||
| 20 | my $dmidecode = Parse::DMIDecode->new; | ||
| 21 | $dmidecode->parse($data); | ||
| 22 | |||
| 23 | return $dmidecode->dmidecode_version ? 1 : 0; | ||
| 24 | }); | ||
| 25 | } | ||
| 26 | |||
| 27 | 1; | ||
| 28 | |||
| 29 | __END__ | ||