File Coverage

blib/lib/FusionInventory/Agent/Task/Inventory/Linux/PowerPC/Bios.pm
Criterion Covered Total %
statement 9 27 33.3
branch 0 4 0.0
condition 0 3 0.0
subroutine 3 5 60.0
pod 0 2 0.0
total 12 41 29.2


line stmt bran cond sub pod time code
1             package FusionInventory::Agent::Task::Inventory::Linux::PowerPC::Bios;
2              
3 1     1   111596693 use strict;
  1         2  
  1         39  
4 1     1   8 use warnings;
  1         1  
  1         63  
5              
6 1     1   367 use FusionInventory::Agent::Tools;
  1         3  
  1         344  
7              
8             sub isEnabled {
9 0     0 0   return 1;
10             }
11              
12             sub doInventory {
13 0     0 0   my (%params) = @_;
14              
15 0           my $inventory = $params{inventory};
16              
17 0           my $bios;
18              
19 0           $bios->{SSN} = getFirstLine(file => '/proc/device-tree/serial-number');
20 0           $bios->{SSN} =~ s/[^\,^\.^\w^\ ]//g; # I remove some unprintable char
21              
22 0           $bios->{SMODEL} = getFirstLine(file => '/proc/device-tree/model');
23 0           $bios->{SMODEL} =~ s/[^\,^\.^\w^\ ]//g;
24              
25 0           my $colorCode = getFirstLine(file => '/proc/device-tree/color-code');
26 0           my ($color) = unpack "h7" , $colorCode;
27 0 0         $bios->{SMODEL} .= " color: $color" if $color;
28              
29             $bios->{BVERSION} =
30 0           getFirstLine(file => '/proc/device-tree/openprom/model');
31 0           $bios->{BVERSION} =~ s/[^\,^\.^\w^\ ]//g;
32              
33 0           my $copyright = getFirstLine(file => '/proc/device-tree/copyright');
34 0 0 0       if ($copyright && $copyright =~ /Apple/) {
35             # What about the Apple clone?
36 0           $bios->{BMANUFACTURER} = "Apple Computer, Inc.";
37 0           $bios->{SMANUFACTURER} = "Apple Computer, Inc.";
38             }
39              
40 0           $inventory->setBios($bios);
41             }
42              
43             1;