r46778 - in /trunk/libemail-simple-perl: Changes MANIFEST META.yml Makefile.PL debian/changelog lib/Email/Simple.pm lib/Email/Simple/Creator.pm lib/Email/Simple/Header.pm t/create.t t/perl-minver.t

nhandler-guest at users.alioth.debian.org nhandler-guest at users.alioth.debian.org
Thu Nov 5 04:34:37 UTC 2009


Author: nhandler-guest
Date: Thu Nov  5 04:34:32 2009
New Revision: 46778

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=46778
Log:
Update to 2.100

Added:
    trunk/libemail-simple-perl/lib/Email/Simple/Creator.pm
      - copied unchanged from r46777, branches/upstream/libemail-simple-perl/current/lib/Email/Simple/Creator.pm
    trunk/libemail-simple-perl/t/create.t
      - copied unchanged from r46777, branches/upstream/libemail-simple-perl/current/t/create.t
Modified:
    trunk/libemail-simple-perl/Changes
    trunk/libemail-simple-perl/MANIFEST
    trunk/libemail-simple-perl/META.yml
    trunk/libemail-simple-perl/Makefile.PL
    trunk/libemail-simple-perl/debian/changelog
    trunk/libemail-simple-perl/lib/Email/Simple.pm
    trunk/libemail-simple-perl/lib/Email/Simple/Header.pm
    trunk/libemail-simple-perl/t/perl-minver.t

Modified: trunk/libemail-simple-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-simple-perl/Changes?rev=46778&op=diff
==============================================================================
--- trunk/libemail-simple-perl/Changes (original)
+++ trunk/libemail-simple-perl/Changes Thu Nov  5 04:34:32 2009
@@ -1,4 +1,7 @@
 Revision history for Perl extension Email::Simple.
+
+2.100     2009-11-03
+          merge Email-Simple-Creator into Email-Simple distribution
 
 2.005     2009-01-22
           add repository metadata

Modified: trunk/libemail-simple-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-simple-perl/MANIFEST?rev=46778&op=diff
==============================================================================
--- trunk/libemail-simple-perl/MANIFEST (original)
+++ trunk/libemail-simple-perl/MANIFEST Thu Nov  5 04:34:32 2009
@@ -1,11 +1,14 @@
 Changes
 lib/Email/Simple.pm
+lib/Email/Simple/Creator.pm
 lib/Email/Simple/Header.pm
+LICENSE
 Makefile.PL
 MANIFEST
 README
 t/badly-folded.t
 t/basic.t
+t/create.t
 t/ct-header.t
 t/folding.t
 t/header-case.t
@@ -34,5 +37,4 @@
 t/test-mails/many-repeats
 t/undef-message.t
 t/unit.t
-LICENSE
 META.yml                                 Module meta-data (added by MakeMaker)

Modified: trunk/libemail-simple-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-simple-perl/META.yml?rev=46778&op=diff
==============================================================================
--- trunk/libemail-simple-perl/META.yml (original)
+++ trunk/libemail-simple-perl/META.yml Thu Nov  5 04:34:32 2009
@@ -1,21 +1,24 @@
 --- #YAML:1.0
 name:               Email-Simple
-version:            2.005
+version:            2.100
 abstract:           ~
 author:  []
 license:            perl
 distribution_type:  module
 configure_requires:
     ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
 requires:
-    Test::More:  0.47
+    Email::Date::Format:  0
+    Test::More:           0.47
 resources:
     Repository:  http://github.com/rjbs/email-simple
 no_index:
     directory:
         - t
         - inc
-generated_by:       ExtUtils::MakeMaker version 6.48
+generated_by:       ExtUtils::MakeMaker version 6.55_02
 meta-spec:
     url:      http://module-build.sourceforge.net/META-spec-v1.4.html
     version:  1.4

Modified: trunk/libemail-simple-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-simple-perl/Makefile.PL?rev=46778&op=diff
==============================================================================
--- trunk/libemail-simple-perl/Makefile.PL (original)
+++ trunk/libemail-simple-perl/Makefile.PL Thu Nov  5 04:34:32 2009
@@ -6,7 +6,6 @@
 # This is so stupid!  We need to make sure that Email::MIME, a downstream
 # module, is running a version that doesn't screw around with the guts of
 # Email::Simple.
-my @prereq;
 if (eval { require Email::MIME }) {
   unless (eval { Email::MIME->VERSION(1.857) }) {
     warn <<END_ACHTUNG;
@@ -25,8 +24,8 @@
   VERSION_FROM  => 'lib/Email/Simple.pm',
   (eval { ExtUtils::MakeMaker->VERSION(6.21) } ? (LICENSE => 'perl') : ()),
   PREREQ_PM     => {
-    @prereq,
     'Test::More' => '0.47',
+    'Email::Date::Format' => 0,
   },
   (eval { ExtUtils::MakeMaker->VERSION(6.46) }
     ? (META_MERGE => {

Modified: trunk/libemail-simple-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-simple-perl/debian/changelog?rev=46778&op=diff
==============================================================================
--- trunk/libemail-simple-perl/debian/changelog (original)
+++ trunk/libemail-simple-perl/debian/changelog Thu Nov  5 04:34:32 2009
@@ -1,3 +1,9 @@
+libemail-simple-perl (2.100-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Nathan Handler <nhandler at nathan-laptop>  Wed, 04 Nov 2009 22:34:13 -0600
+
 libemail-simple-perl (2.005-1) UNRELEASED; urgency=low
 
   IGNORE-VERSION: 2.005-1

Modified: trunk/libemail-simple-perl/lib/Email/Simple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-simple-perl/lib/Email/Simple.pm?rev=46778&op=diff
==============================================================================
--- trunk/libemail-simple-perl/lib/Email/Simple.pm (original)
+++ trunk/libemail-simple-perl/lib/Email/Simple.pm Thu Nov  5 04:34:32 2009
@@ -1,13 +1,15 @@
+use 5.006;
+use strict;
+use warnings;
 package Email::Simple;
 
-use 5.00503; # why? -- rjbs, 2007-04-01
-use strict;
 use Carp ();
 
+use Email::Simple::Creator;
 use Email::Simple::Header;
 
-$Email::Simple::VERSION = '2.005';
-$Email::Simple::GROUCHY = 0;
+our $VERSION = '2.100';
+our $GROUCHY = 0;
 
 # We are liberal in what we accept.
 sub __crlf_re { qr/\x0a\x0d|\x0d\x0a|\x0a|\x0d/; }
@@ -28,6 +30,21 @@
   my $old_body = $email->body;
   $email->body_set("Hello world\nSimon");
 
+  print $email->as_string;
+
+...or, to create a message from scratch...
+  
+  my $email = Email::Simple->create(
+      header => [
+        From    => 'casey at geeknest.com',
+        To      => 'drain at example.com',
+        Subject => 'Message in a bottle',
+      ],
+      body => '...',
+  );
+  
+  $email->header_set( 'X-Content-Container' => 'bottle/glass' );
+  
   print $email->as_string;
 
 =head1 DESCRIPTION
@@ -109,6 +126,58 @@
   }
 }
 
+=head2 create
+
+  my $email = Email::Simple->create(header => [ @headers ], body => '...');
+
+This method is a constructor that creates an Email::Simple object
+from a set of named parameters. The C<header> parameter's value is a
+list reference containing a set of headers to be created. The C<body>
+parameter's value is a scalar value holding the contents of the message
+body.  Line endings in the body will normalized to CRLF.
+
+If no C<Date> header is specified, one will be provided for you based on the
+C<gmtime> of the local machine. This is because the C<Date> field is a required
+header and is a pain in the neck to create manually for every message. The
+C<From> field is also a required header, but it is I<not> provided for you.
+
+=cut
+
+our $CREATOR = 'Email::Simple::Creator';
+
+sub create {
+  my ($class, %args) = @_;
+
+  # We default it in here as well as below because by having it here, then we
+  # know that if there are no other headers, we'll get the proper CRLF.
+  # Otherwise, we get a message with incorrect CRLF. -- rjbs, 2007-07-13
+  my $headers = $args{header} || [ Date => $CREATOR->_date_header ];
+  my $body    = $args{body} || '';
+
+  my $empty   = q{};
+  my $header  = \$empty;
+
+  for my $idx (map { $_ * 2 } 0 .. @$headers / 2 - 1) {
+    my ($key, $value) = @$headers[ $idx, $idx + 1 ];
+    $CREATOR->_add_to_header($header, $key, $value);
+  }
+
+  $CREATOR->_finalize_header($header);
+
+  my $email = $class->new($header);
+
+  $email->header_set(Date => $CREATOR->_date_header)
+    unless defined $email->header('Date');
+
+  $body = (join $CREATOR->_crlf, split /\x0d\x0a|\x0a\x0d|\x0a|\x0d/, $body)
+        . $CREATOR->_crlf;
+
+  $email->body_set($body);
+
+  return $email;
+}
+
+
 =head2 header_obj
 
   my $header = $email->header_obj;
@@ -155,7 +224,8 @@
     $email->header_set($field, $line1, $line2, ...);
 
 Sets the header to contain the given data. If you pass multiple lines
-in, you get multiple headers, and order is retained.
+in, you get multiple headers, and order is retained.  If no values are given to
+set, the header will be removed from to the message entirely.
 
 =head2 header_names
 

Modified: trunk/libemail-simple-perl/lib/Email/Simple/Header.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-simple-perl/lib/Email/Simple/Header.pm?rev=46778&op=diff
==============================================================================
--- trunk/libemail-simple-perl/lib/Email/Simple/Header.pm (original)
+++ trunk/libemail-simple-perl/lib/Email/Simple/Header.pm Thu Nov  5 04:34:32 2009
@@ -185,7 +185,8 @@
   $header->header_set($field => @values);
 
 This method updates the value of the given header.  Existing headers have their
-values set in place.  Additional headers are added at the end.
+values set in place.  Additional headers are added at the end.  If no values
+are given to set, the header will be removed from to the message entirely.
 
 =cut
 

Modified: trunk/libemail-simple-perl/t/perl-minver.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libemail-simple-perl/t/perl-minver.t?rev=46778&op=diff
==============================================================================
--- trunk/libemail-simple-perl/t/perl-minver.t (original)
+++ trunk/libemail-simple-perl/t/perl-minver.t Thu Nov  5 04:34:32 2009
@@ -10,4 +10,4 @@
 
 plan skip_all => "this test requires Test::MinimumVersion" if $@;
 
-all_minimum_version_ok(5.00503);
+all_minimum_version_ok(5.006);




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