Parse::DMIDecode(3pm)

πŸ“¦
version 0.03 Β· 6 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸŽ€ 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 dmidecode argument is where you tell it the full path and filename of the dmodecode command that the probe method should use.
  • The nowarnings argument 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 πŸ‘€


πŸ“ 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 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