| 1 |
NAME |
| 2 |
Parse::DMIDecode - Interface to SMBIOS using dmidecode |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
use strict; |
| 6 |
use Parse::DMIDecode (); |
| 7 |
|
| 8 |
my $decoder = new Parse::DMIDecode; |
| 9 |
$decoder->probe; # Actively probe using dmidecode |
| 10 |
|
| 11 |
# Manually supply your own dmidecode output to be parsed |
| 12 |
# $decoder->parse(qx(sudo /usr/sbin/dmidecode)); |
| 13 |
|
| 14 |
printf("System: %s, %s", |
| 15 |
$decoder->keyword("system-manufacturer"), |
| 16 |
$decoder->keyword("system-product-name"), |
| 17 |
); |
| 18 |
|
| 19 |
DESCRIPTION |
| 20 |
This module provides an OO interface to SMBIOS information through the |
| 21 |
*dmidecode* command which is known to work under a number of Linux, BSD |
| 22 |
and BeOS variants. |
| 23 |
|
| 24 |
METHODS |
| 25 |
new |
| 26 |
my $decoder = Parse::DMIDecode->new( |
| 27 |
dmidecode => "/usr/sbin/dmidecode", |
| 28 |
nowarnings => 1, |
| 29 |
); |
| 30 |
|
| 31 |
This is the constructor method to create a Parse::DMIDeocde object. It |
| 32 |
accepts two optional arguments; "dmidecode" and "nowarnings". |
| 33 |
|
| 34 |
The "dmidecode" argument specifies the full path and filename of the |
| 35 |
*dmodecode* command that should used by the "probe" method. |
| 36 |
|
| 37 |
The "nowarnings" argument instructs Parse::DMIDecode not to emit any |
| 38 |
parser warnings. |
| 39 |
|
| 40 |
probe |
| 41 |
$decoder->probe; |
| 42 |
|
| 43 |
This method executes an active probe to gather information using the |
| 44 |
*dmidecode* command. It does not accept any arguments. |
| 45 |
|
| 46 |
parse |
| 47 |
my $raw = qx(sudo /usr/sbin/dmidecode); |
| 48 |
$decoder->prase($raw); |
| 49 |
|
| 50 |
This method is a passive alternative to the "probe" method. It accepts a |
| 51 |
single string argument which should contain output from the *dmidecode* |
| 52 |
command, which it will parse. |
| 53 |
|
| 54 |
keyword |
| 55 |
my $serial_number = $decoder->keyword("system-serial-number"); |
| 56 |
|
| 57 |
keywords |
| 58 |
my @keywords = $decoder->keywords; |
| 59 |
my @bios_keywords = $decoder->keywords("bios"); |
| 60 |
|
| 61 |
for my $keyword (@bios_keywords) { |
| 62 |
printf("%s => %s\n", |
| 63 |
$keyword, |
| 64 |
$decoder->keyword($keyword) |
| 65 |
); |
| 66 |
} |
| 67 |
|
| 68 |
handle_addresses |
| 69 |
my @addresses = $decoder->handle_addresses; |
| 70 |
|
| 71 |
get_handles |
| 72 |
use Parse::DMIDecode::Constants qw(@TYPES); |
| 73 |
|
| 74 |
# Available groups to query: bios, system, baseboard, |
| 75 |
# chassis, processor, memory, cache, connector, slot |
| 76 |
for my $handle ($decoder->get_handles( group => "memory" )) { |
| 77 |
printf(">> Found handle at %s (%s):\n%s\n", |
| 78 |
$handle->address, |
| 79 |
$TYPES[$handle->dmitype], |
| 80 |
$handle->raw |
| 81 |
); |
| 82 |
} |
| 83 |
|
| 84 |
See Parse::DMIDecode::Handle for accessor method documentation for |
| 85 |
handle objects. |
| 86 |
|
| 87 |
smbios_version |
| 88 |
my $smbios_version = $decoder->smbios_version; |
| 89 |
|
| 90 |
Returns the SMBIOS version number. |
| 91 |
|
| 92 |
dmidecode_version |
| 93 |
my $dmidecode_version = $decoder->dmidecode_version; |
| 94 |
|
| 95 |
Returns the version number of the copy of *dmidecode* that was used to |
| 96 |
create the source data that was parsed. This value may not be available |
| 97 |
when using older versions of *dmidecode*. |
| 98 |
|
| 99 |
table_location |
| 100 |
my $memory_address = $decoder->table_location; |
| 101 |
|
| 102 |
structures |
| 103 |
my $total_structures = $decoder->structures; |
| 104 |
|
| 105 |
SEE ALSO |
| 106 |
Parse::DMIDecode::Handle, Parse::DMIDecode::Constants, |
| 107 |
Parse::DMIDecode::Examples, examples/*.pl, |
| 108 |
<http://search.cpan.org/src/NICOLAW/Parse-DMIDecode-0.03/examples/>, |
| 109 |
<http://www.nongnu.org/dmidecode/>, <http://linux.dell.com/libsmbios/>, |
| 110 |
<http://sourceforge.net/projects/x86info/>, |
| 111 |
<http://www.dmtf.org/standards/smbios>, biosdecode(8), dmidecode(8), |
| 112 |
vpddecode(8) |
| 113 |
|
| 114 |
VERSION |
| 115 |
$Id: DMIDecode.pm 1004 2007-03-11 12:43:25Z nicolaw $ |
| 116 |
|
| 117 |
AUTHOR |
| 118 |
Nicola Worthington <[email protected]> |
| 119 |
|
| 120 |
<http://perlgirl.org.uk> |
| 121 |
|
| 122 |
If you like this software, why not show your appreciation by sending the |
| 123 |
author something nice from her Amazon wishlist? ( |
| 124 |
http://www.amazon.co.uk/gp/registry/1VZXC59ESWYK0?sort=priority ) |
| 125 |
|
| 126 |
COPYRIGHT |
| 127 |
Copyright 2006,2007 Nicola Worthington. |
| 128 |
|
| 129 |
This software is licensed under The Apache Software License, Version |
| 130 |
2.0. |
| 131 |
|
| 132 |
<http://www.apache.org/licenses/LICENSE-2.0> |
| 133 |
|