Skip Menu |
 

This queue is for tickets about the Parse-DMIDecode CPAN distribution.

Report information
The Basics
Id: 54956
Status: new
Priority: 0/
Queue: Parse-DMIDecode

People
Owner: Nobody in particular
Requestors: dmo [...] roaringpenguin.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [PATCH] Initialize $data{structures} to 0 when it's not found.
Date: Wed, 24 Feb 2010 17:16:17 -0500
To: bug-parse-dmidecode [...] rt.cpan.org
From: "Dave O'Neill" <dmo [...] roaringpenguin.com>
Download (untitled) / with headers
text/plain 912b
This prevents a "Use of uninitialized value" warning when parsing incomplete dmidecode output diff --git a/lib/Parse/DMIDecode.pm b/lib/Parse/DMIDecode.pm index 441bff1..d5835c0 100644 --- a/lib/Parse/DMIDecode.pm +++ b/lib/Parse/DMIDecode.pm @@ -170,10 +170,13 @@ sub parse { } } - for (qw(dmidecode structures bytes dmi smbios location)) { + for (qw(dmidecode bytes dmi smbios location)) { $data{$_} = undef if !exists $data{$_}; } + # {structures} should be zero if missing, as we use it in comparisons below. + $data{structures} = 0 if !exists $data{structures}; + my $raw_handle_data = ''; for (; $i < @lines; $i++) { if ($lines[$i] =~ /^Handle [0-9A-Fx]+/) { -- Dave O'Neill <dmo@roaringpenguin.com> Roaring Penguin Software Inc. +1 (613) 231-6599 http://www.roaringpenguin.com/ For CanIt technical support, please mail: support@roaringpenguin.com


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.