Subject: [PATCH] Return the value of a variable, that actually exists, and re-use some code from Utils

From: Raphael Geissert <[email-masked]>
Date: Wed, 28 Jan 2009 01:16:03 -0600

Signed-off-by: Raphael Geissert <[email-masked]>
---
 lib/Lintian/Collect/Source.pm |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/Lintian/Collect/Source.pm b/lib/Lintian/Collect/Source.pm
index 3d5dc91..9eef1a0 100644
--- a/lib/Lintian/Collect/Source.pm
+++ b/lib/Lintian/Collect/Source.pm
@@ -89,15 +89,13 @@ sub binaries {
 # Retrieve a field from a binary package
 sub binary_field {
     my ($self, $binpkg, $field) = @_;
-    return $self->{"binary-$binpkg"}{$field}
+    return $self->{"binary_$binpkg"}{$field}
         if exists $self->{"binary_$binpkg"}{$field};
 
     my $value = '';
-    if (open FIELD, "<", "control/$binpkg/$field") {
-        { local $/;
-        $value = <FIELD>; }
+    if (-f "control/$binpkg/$field") {
+        $value = slurp_entire_file("control/$binpkg/$field");
         chomp $value;
-        close FIELD;
     }
     $self->{"binary_$binpkg"}{$field} = $value;