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   102098 use v5.12.5;
  2         18  
8 2     2   10 use warnings;
  2         5  
  2         87  
9              
10             our $VERSION = '1.14.3'; # VERSION
11              
12 2     2   433 use Rex::Inventory::Proc::Cpuinfo;
  2         6  
  2         24  
13              
14             sub new {
15 2     2 0 2859 my $that = shift;
16 2   33     11 my $proto = ref($that) || $that;
17 2         5 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         13 my $p_cpu = Rex::Inventory::Proc::Cpuinfo->new;
30              
31 2         6 $self->{__proc__} = { cpus => $p_cpu->get, };
32             }
33              
34             sub get_cpus {
35 1     1 0 3 my ($self) = @_;
36 1         5 return $self->{__proc__}->{cpus};
37             }
38              
39             1;