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