File Coverage

lib/Ixchel/functions/product.pm
Criterion Covered Total %
statement 14 17 82.3
branch n/a
condition n/a
subroutine 5 6 83.3
pod 1 1 100.0
total 20 24 83.3


line stmt bran cond sub pod time code
1             package Ixchel::functions::product;
2              
3 5     5   89926 use 5.006;
  5         20  
4 5     5   26 use strict;
  5         12  
  5         127  
5 5     5   32 use warnings;
  5         16  
  5         269  
6 5     5   458 use File::Slurp;
  5         31134  
  5         619  
7 5     5   56 use Exporter 'import';
  5         21  
  5         644  
8             our @EXPORT = qw(product);
9              
10             =head1 NAME
11              
12             Ixchel::functions::product - Returns the product name of the system found via dmidecode.
13              
14             =head1 VERSION
15              
16             Version 0.0.1
17              
18             =cut
19              
20             our $VERSION = '0.0.1';
21              
22             =head1 SYNOPSIS
23              
24             use Ixchel::functions::product;
25              
26             print 'Product: '.product."\n";
27              
28             =head1 Functions
29              
30             =head2 product
31              
32             Fetches system-product-name via dmidecode.
33              
34             If not ran as root, this will return blank.
35              
36             =cut
37              
38             sub product {
39 0     0 1   my $output = `dmidecode --string=system-product-name 2> /dev/null`;
40 0           chomp($output);
41              
42 0           return $output;
43             }
44              
45             1;