File Coverage

blib/lib/Ixchel/functions/sys_info.pm
Criterion Covered Total %
statement 26 30 86.6
branch n/a
condition n/a
subroutine 9 10 90.0
pod 1 1 100.0
total 36 41 87.8


line stmt bran cond sub pod time code
1             package Ixchel::functions::sys_info;
2              
3 4     4   126376 use 5.006;
  4         13  
4 4     4   17 use strict;
  4         5  
  4         78  
5 4     4   13 use warnings;
  4         5  
  4         182  
6 4     4   1556 use File::Slurp;
  4         120874  
  4         322  
7 4     4   39 use Exporter 'import';
  4         7  
  4         224  
8             our @EXPORT = qw(sys_info);
9 4     4   2748 use Rex -feature => [qw/1.4/];
  4         296648  
  4         42  
10 4     4   1378735 use Rex::Hardware;
  4         10  
  4         99  
11 4     4   41 use Ixchel::functions::product;
  4         12  
  4         230  
12 4     4   51 use Ixchel::functions::serial;
  4         43  
  4         767  
13              
14              
15             # prevents Rex from printing out rex is exiting after the script ends
16             $::QUIET = 2;
17              
18             =head1 NAME
19              
20             Ixchel::functions::sys_info - Fetches system info via Rex::Hardware.
21              
22             =head1 VERSION
23              
24             Version 0.0.1
25              
26             =cut
27              
28             our $VERSION = '0.0.1';
29              
30             =head1 SYNOPSIS
31              
32             use Ixchel::functions::sys_info;
33             use Data::Dumper;
34              
35             my $returned=sys_info;
36              
37             print Dumper($returned);
38              
39             $returned->{Host}{product} is filled in via Ixchel::functions::product and
40             $returned->{Host}{serial} is filled in via Ixchel::functions::serial for the purpose
41             making sure those are handled properly in a cross platform manner given a bug in Rex.
42              
43             =head1 Functions
44              
45             =head2 sys_info
46              
47             Calls L->get and returns the data as a hash ref.
48              
49             =cut
50              
51             sub sys_info {
52 0     0 1   my %all=Rex::Hardware->get(qw/ All /);
53              
54 0           $all{Host}{product}=product;
55 0           $all{Host}{serial}=serial_num;
56              
57 0           return \%all;
58             }
59              
60             1;