| 1 | package Ixchel::functions::product; | ||
| 2 | |||
| 3 | use 5.006; | ||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 6 | use File::Slurp; | ||
| 7 | use Exporter 'import'; | ||
| 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 | my $output = `dmidecode --string=system-product-name 2> /dev/null`; | ||
| 40 | chomp($output); | ||
| 41 | |||
| 42 | return $output; | ||
| 43 | } | ||
| 44 | |||
| 45 | 1; |