From 9e6831a788cf0c60d516ac8d89a971525f749bee Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Wed, 8 Aug 2012 19:36:28 +0000 Subject: avoid some warnings for undefined values --- lib/Parse/EDID.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/Parse') diff --git a/lib/Parse/EDID.pm b/lib/Parse/EDID.pm index cf13475..0e45cd2 100755 --- a/lib/Parse/EDID.pm +++ b/lib/Parse/EDID.pm @@ -514,7 +514,10 @@ sub parse_edid { # if the mm size given in the detailed_timing is not far from the cm size # put it as a more precise cm size - my %in_cm = map { $_ => $h->{$_ . '_image_size'} / 10 } ('horizontal', 'vertical'); + my %in_cm = ( + horizontal => _define($h->{horizontal_image_size}) / 10, + vertical => _define($h->{vertical_image_size}) / 10, + ); my ($error) = sort { $b <=> $a } map { abs($edid{'max_size_' . $_} - $in_cm{$_}) } keys %in_cm; if ($error <= 0.5) { $edid{'max_size_' . $_} = $in_cm{$_} foreach keys %in_cm; @@ -632,6 +635,7 @@ sub find_edid_in_string { @edids; } +sub _define { defined $_[0] ? $_[0] : 0 } sub _sqr { $_[0] * $_[0] } sub _round { int($_[0] + 0.5) } sub _group_by2 { -- cgit v1.2.1