Package: libemail-abstract-perl
Version: 2.134-2
Severity: minor
Tags: patch


As documented in http://rt.cpan.org/Public/Bug/Display.html?id=32198,
the use of uninitialized variables in Email::Abstract::MailInternet 
causes copious warnings in the tests Mail::Thread.

I propose the attached patch. It eliminates the warnings; I would appreciate
any feedback peoply might have. Of course we can add this patch the RT ticket 
above. Actually my patch is (IMHO) a slight improvement on the one above.
Of course that should make you really worried :-)


-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-1-686 (SMP w/2 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libemail-abstract-perl depends on:
ii  libemail-simple-perl          2.004-1    Simple parsing of RFC2822 message 
ii  perl                          5.10.0-13  Larry Wall's Practical Extraction 
ii  perl-modules [libmodule-plugg 5.10.0-13  Core Perl modules

libemail-abstract-perl recommends no packages.

libemail-abstract-perl suggests no packages.

-- no debconf information
diff --git a/lib/Email/Abstract/MailInternet.pm b/lib/Email/Abstract/MailInternet.pm
index 4457216..ea9cc69 100644
--- a/lib/Email/Abstract/MailInternet.pm
+++ b/lib/Email/Abstract/MailInternet.pm
@@ -25,6 +25,12 @@ sub get_header {
     my ($class, $obj, $header) = @_; 
     my @values = $obj->head->get($header); 
 
+    # early exit to avoid warnings about undefined values
+    # based on a patch by adriano ferreira, except we return 
+    # an empty list in a list context.
+    if (!scalar(@values)){
+	return wantarray  ? () : undef;
+    }
     # No reason to s/// lots of values if we're just going to return one.
     $#values = 0 if not wantarray;
 

Reply via email to