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   101264 use v5.12.5;
  2         18  
8 2     2   13 use warnings;
  2         7  
  2         97  
9              
10             our $VERSION = '1.14.2.2'; # TRIAL VERSION
11              
12 2     2   435 use Rex::Inventory::Proc::Cpuinfo;
  2         5  
  2         22  
13              
14             sub new {
15 2     2 0 3074 my $that = shift;
16 2   33     16 my $proto = ref($that) || $that;
17 2         8 my $self = {@_};
18              
19 2         5 bless( $self, $proto );
20              
21 2         30 $self->_read_proc();
22              
23 2         16 return $self;
24             }
25              
26             sub _read_proc {
27 2     2   5 my ($self) = @_;
28              
29 2         13 my $p_cpu = Rex::Inventory::Proc::Cpuinfo->new;
30              
31 2         9 $self->{__proc__} = { cpus => $p_cpu->get, };
32             }
33              
34             sub get_cpus {
35 1     1 0 4 my ($self) = @_;
36 1         5 return $self->{__proc__}->{cpus};
37             }
38              
39             1;