aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Parse
diff options
context:
space:
mode:
authorGuillaume Rousse <guillomovitch@mageia.org>2012-08-08 19:36:28 +0000
committerGuillaume Rousse <guillomovitch@mageia.org>2012-08-08 19:36:28 +0000
commit9e6831a788cf0c60d516ac8d89a971525f749bee (patch)
tree915b6830de0e68a6a6df598acc1802aa2581456c /lib/Parse
parenta4081237b4d357720313a042d0203c724b1f6264 (diff)
downloadperl-Parse-EDID-9e6831a788cf0c60d516ac8d89a971525f749bee.tar
perl-Parse-EDID-9e6831a788cf0c60d516ac8d89a971525f749bee.tar.gz
perl-Parse-EDID-9e6831a788cf0c60d516ac8d89a971525f749bee.tar.bz2
perl-Parse-EDID-9e6831a788cf0c60d516ac8d89a971525f749bee.tar.xz
perl-Parse-EDID-9e6831a788cf0c60d516ac8d89a971525f749bee.zip
avoid some warnings for undefined values
Diffstat (limited to 'lib/Parse')
-rwxr-xr-xlib/Parse/EDID.pm6
1 files changed, 5 insertions, 1 deletions
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 {