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