r3680 - in /packages/libemail-simple-perl/branches/upstream/current: Changes MANIFEST META.yml lib/Email/Simple.pm t/basic.t t/undef-message.t

gregoa-guest at users.alioth.debian.org gregoa-guest at users.alioth.debian.org
Sat Sep 9 18:56:26 UTC 2006


Author: gregoa-guest
Date: Sat Sep  9 18:56:25 2006
New Revision: 3680

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=3680
Log:
Load /tmp/tmp.xsvdG18217/libemail-simple-perl-1.990 into
packages/libemail-simple-perl/branches/upstream/current.

Added:
    packages/libemail-simple-perl/branches/upstream/current/t/undef-message.t
Modified:
    packages/libemail-simple-perl/branches/upstream/current/Changes
    packages/libemail-simple-perl/branches/upstream/current/MANIFEST
    packages/libemail-simple-perl/branches/upstream/current/META.yml
    packages/libemail-simple-perl/branches/upstream/current/lib/Email/Simple.pm
    packages/libemail-simple-perl/branches/upstream/current/t/basic.t

Modified: packages/libemail-simple-perl/branches/upstream/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-simple-perl/branches/upstream/current/Changes?rev=3680&op=diff
==============================================================================
--- packages/libemail-simple-perl/branches/upstream/current/Changes (original)
+++ packages/libemail-simple-perl/branches/upstream/current/Changes Sat Sep  9 18:56:25 2006
@@ -1,4 +1,9 @@
 Revision history for Perl extension Email::Simple.
+
+1.990    2006-09-05
+
+  - ->header('foo') returns false if there is no foo header (formerly '')
+  - croak if an undef value is passed to new()
 
 1.980    2006-08-17
 

Modified: packages/libemail-simple-perl/branches/upstream/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-simple-perl/branches/upstream/current/MANIFEST?rev=3680&op=diff
==============================================================================
--- packages/libemail-simple-perl/branches/upstream/current/MANIFEST (original)
+++ packages/libemail-simple-perl/branches/upstream/current/MANIFEST Sat Sep  9 18:56:25 2006
@@ -26,5 +26,6 @@
 t/test-mails/junk-in-header
 t/test-mails/long-msgid
 t/test-mails/many-repeats
+t/undef-message.t
 t/unit.t
 META.yml                                 Module meta-data (added by MakeMaker)

Modified: packages/libemail-simple-perl/branches/upstream/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-simple-perl/branches/upstream/current/META.yml?rev=3680&op=diff
==============================================================================
--- packages/libemail-simple-perl/branches/upstream/current/META.yml (original)
+++ packages/libemail-simple-perl/branches/upstream/current/META.yml Sat Sep  9 18:56:25 2006
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Email-Simple
-version:      1.980
+version:      1.990
 version_from: lib/Email/Simple.pm
 installdirs:  site
 requires:

Modified: packages/libemail-simple-perl/branches/upstream/current/lib/Email/Simple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-simple-perl/branches/upstream/current/lib/Email/Simple.pm?rev=3680&op=diff
==============================================================================
--- packages/libemail-simple-perl/branches/upstream/current/lib/Email/Simple.pm (original)
+++ packages/libemail-simple-perl/branches/upstream/current/lib/Email/Simple.pm Sat Sep  9 18:56:25 2006
@@ -5,7 +5,7 @@
 use Carp;
 
 use vars qw($VERSION $GROUCHY);
-$VERSION = '1.980';
+$VERSION = '1.990';
 
 my $crlf = qr/\x0a\x0d|\x0d\x0a|\x0a|\x0d/; # We are liberal in what we accept.
 
@@ -52,6 +52,9 @@
 
 sub new {
     my ($class, $text) = @_;
+
+    croak 'Unable to parse undefined message' if !defined $text;
+
     my ($head, $body, $mycrlf) = _split_head_from_body($text);
     my ($head_hash, $order) = _read_headers($head);
     bless {
@@ -121,7 +124,10 @@
 
 sub header {
     my ($self, $field) = @_;
-    return '' unless $field = $self->{header_names}->{lc $field};
+    return unless
+      (exists $self->{header_names}->{lc $field})
+      and $field = $self->{header_names}->{lc $field};
+
     return wantarray ? @{$self->{head}->{$field}}
                      :   $self->{head}->{$field}->[0];
 }

Modified: packages/libemail-simple-perl/branches/upstream/current/t/basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-simple-perl/branches/upstream/current/t/basic.t?rev=3680&op=diff
==============================================================================
--- packages/libemail-simple-perl/branches/upstream/current/t/basic.t (original)
+++ packages/libemail-simple-perl/branches/upstream/current/t/basic.t Sat Sep  9 18:56:25 2006
@@ -19,7 +19,11 @@
 is($mail->header_set("From", $sc), $sc, "Setting returns new value");
 is($mail->header("From"), $sc, "Which is consistently returned");
 
-is($mail->header("Bogus"), '', "missing header returns '' (this may change!)");
+is(
+  $mail->header("Bogus"),
+  undef,
+  "missing header returns undef"
+);
 
 # Put andrew back:
 $mail->header_set("From", $old_from);

Added: packages/libemail-simple-perl/branches/upstream/current/t/undef-message.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-simple-perl/branches/upstream/current/t/undef-message.t?rev=3680&op=file
==============================================================================
--- packages/libemail-simple-perl/branches/upstream/current/t/undef-message.t (added)
+++ packages/libemail-simple-perl/branches/upstream/current/t/undef-message.t Sat Sep  9 18:56:25 2006
@@ -1,0 +1,11 @@
+#!/usr/bin/perl -w
+use strict;
+use Test::More tests => 3;
+
+use_ok("Email::Simple");
+
+eval { Email::Simple->new };
+
+ok( $@, 'throws an error' );
+like( $@, qr/unable to parse undefined message/i, 'throws sane error' );
+




More information about the Pkg-perl-cvs-commits mailing list