Parse::DMIDecode(3pm)
π NAME π
Parse::DMIDecode β okay so it's your whole interface to SMBIOS, and it gets there by way of the dmidecode command. That's the vibe. That's the whole thing. π
β¨ 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 π¦
So basically this module hands you an OO interface to SMBIOS info, and it pulls that info through the dmidecode command β which, bestie, is known to work under a bunch of Linux, BSD and BeOS variants. iconic behaviour honestly π
π METHODS π
πΈ new
my $decoder = Parse::DMIDecode->new(
dmidecode => "/usr/sbin/dmidecode",
nowarnings => 1,
);
This is the constructor method, and it's the one that makes you a Parse::DMIDeocde object π«Ά It takes two optional arguments and their names are dmidecode and nowarnings.
- The
dmidecodeargument is where you tell it the full path and filename of thedmodecodecommand that theprobemethod should use. - The
nowarningsargument tells Parse::DMIDecode to please not emit any parser warnings. shhh. π€«
π₯ probe
$decoder->probe;
This one runs an active probe to gather all the info using the dmidecode command. It does not accept any arguments β it just goes. periodt. β
π§ parse
my $raw = qx(sudo /usr/sbin/dmidecode);
$decoder->prase($raw);
This is the passive alternative to the probe method β¨ It takes a single string argument, and that string should contain output from the dmidecode command β because that's the thing it's gonna 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
);
}
If you want the accessor method docs for handle objects, go peek at Parse::DMIDecode::Handle β that's where they live π
π¦ 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 got parsed. Heads up though bestie: this value may not be available when you're using older versions of dmidecode. π
π table_location
my $memory_address = $decoder->table_location;
π structures
my $total_structures = $decoder->structures;
π SEE ALSO π
Parse::DMIDecode::HandleParse::DMIDecode::ConstantsParse::DMIDecode::Examplesexamples/*.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>
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>
okay that's the whole page bestie, no notes π
and for the lil sign-off: this was perl v5.36.0, dated 2022-10-13 β Parse::DMIDecode(3pm), ate and left no crumbs, mwah π«Άπ
π¦ where this page comes from
- ubuntu noble: libparse-dmidecode-perl 0.03-4 Β· Apache-2.0
- ubuntu resolute: libparse-dmidecode-perl 0.03-4 Β· Apache-2.0
- ubuntu stonking: libparse-dmidecode-perl 0.03-4 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms