File Coverage

lib/Rex/Inventory/Proc.pm
Criterion Covered Total %
statement 19 19 100.0
branch n/a
condition 1 3 33.3
subroutine 6 6 100.0
pod 0 2 0.0
total 26 30 86.6


line stmt bran cond sub pod time code
1             #
2             # (c) Jan Gehring
3             #
4              
5             package Rex::Inventory::Proc;
6              
7 2     2   102414 use v5.12.5;
  2         17  
8 2     2   11 use warnings;
  2         6  
  2         90  
9              
10             our $VERSION = '1.14.2.3'; # TRIAL VERSION
11              
12 2     2   443 use Rex::Inventory::Proc::Cpuinfo;
  2         4  
  2         24  
13              
14             sub new {
15 2     2 0 2927 my $that = shift;
16 2   33     15 my $proto = ref($that) || $that;
17 2         7 my $self = {@_};
18              
19 2         5 bless( $self, $proto );
20              
21 2         26 $self->_read_proc();
22              
23 2         13 return $self;
24             }
25              
26             sub _read_proc {
27 2     2   5 my ($self) = @_;
28              
29 2         11 my $p_cpu = Rex::Inventory::Proc::Cpuinfo->new;
30              
31 2         11 $self->{__proc__} = { cpus => $p_cpu->get, };
32             }
33              
34             sub get_cpus {
35 1     1 0 3 my ($self) = @_;
36 1         4 return $self->{__proc__}->{cpus};
37             }
38              
39             1;