r3553 - in /packages/libemail-simple-perl/trunk: Changes MANIFEST
META.yml
debian/changelog lib/Email/Simple.pm lib/Email/Simple/ t/header-names.t
t/header-pairs.t t/pod-coverage.t t/preserve-linefeed.t
eloy at users.alioth.debian.org
eloy at users.alioth.debian.org
Thu Aug 31 13:45:17 UTC 2006
Author: eloy
Date: Thu Aug 31 13:45:15 2006
New Revision: 3553
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=3553
Log:
eloy: new upstream version
Added:
packages/libemail-simple-perl/trunk/lib/Email/Simple/
- copied from r3552, packages/libemail-simple-perl/branches/upstream/current/lib/Email/Simple/
packages/libemail-simple-perl/trunk/t/header-names.t
- copied unchanged from r3552, packages/libemail-simple-perl/branches/upstream/current/t/header-names.t
packages/libemail-simple-perl/trunk/t/header-pairs.t
- copied unchanged from r3552, packages/libemail-simple-perl/branches/upstream/current/t/header-pairs.t
packages/libemail-simple-perl/trunk/t/preserve-linefeed.t
- copied unchanged from r3552, packages/libemail-simple-perl/branches/upstream/current/t/preserve-linefeed.t
Modified:
packages/libemail-simple-perl/trunk/Changes
packages/libemail-simple-perl/trunk/MANIFEST
packages/libemail-simple-perl/trunk/META.yml
packages/libemail-simple-perl/trunk/debian/changelog
packages/libemail-simple-perl/trunk/lib/Email/Simple.pm
packages/libemail-simple-perl/trunk/t/pod-coverage.t
Modified: packages/libemail-simple-perl/trunk/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-simple-perl/trunk/Changes?rev=3553&op=diff
==============================================================================
--- packages/libemail-simple-perl/trunk/Changes (original)
+++ packages/libemail-simple-perl/trunk/Changes Thu Aug 31 13:45:15 2006
@@ -1,4 +1,13 @@
Revision history for Perl extension Email::Simple.
+
+1.980 2006-08-17
+
+ - fix _fold() to add a missing line ending [RT #20764] (Brian Cassidy)
+
+1.970 2006-08-17
+
+ - bring ->headers method into Email::Simple
+ - ->header_names and ->header_pairs
1.96 2006-07-28
Modified: packages/libemail-simple-perl/trunk/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-simple-perl/trunk/MANIFEST?rev=3553&op=diff
==============================================================================
--- packages/libemail-simple-perl/trunk/MANIFEST (original)
+++ packages/libemail-simple-perl/trunk/MANIFEST Thu Aug 31 13:45:15 2006
@@ -3,16 +3,20 @@
MANIFEST
README
lib/Email/Simple.pm
+lib/Email/Simple/Headers.pm
t/badly-folded.t
t/basic.t
t/folding.t
t/header-case.t
t/header-junk.t
+t/header-names.t
+t/header-pairs.t
t/long-msgid.t
t/many-repeats.t
t/no-body.t
t/pod-coverage.t
t/pod.t
+t/preserve-linefeed.t
t/test-mails/badly-folded
t/test-mails/badly-folded-noindent
t/test-mails/josey-fold
Modified: packages/libemail-simple-perl/trunk/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-simple-perl/trunk/META.yml?rev=3553&op=diff
==============================================================================
--- packages/libemail-simple-perl/trunk/META.yml (original)
+++ packages/libemail-simple-perl/trunk/META.yml Thu Aug 31 13:45:15 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.96
+version: 1.980
version_from: lib/Email/Simple.pm
installdirs: site
requires:
Modified: packages/libemail-simple-perl/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-simple-perl/trunk/debian/changelog?rev=3553&op=diff
==============================================================================
--- packages/libemail-simple-perl/trunk/debian/changelog (original)
+++ packages/libemail-simple-perl/trunk/debian/changelog Thu Aug 31 13:45:15 2006
@@ -1,3 +1,9 @@
+libemail-simple-perl (1.980-1) unstable; urgency=low
+
+ * New upstream release
+
+ -- Krzysztof Krzyzaniak (eloy) <eloy at debian.org> Thu, 31 Aug 2006 15:27:14 +0200
+
libemail-simple-perl (1.96-1) unstable; urgency=low
* New upstream release
Modified: packages/libemail-simple-perl/trunk/lib/Email/Simple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-simple-perl/trunk/lib/Email/Simple.pm?rev=3553&op=diff
==============================================================================
--- packages/libemail-simple-perl/trunk/lib/Email/Simple.pm (original)
+++ packages/libemail-simple-perl/trunk/lib/Email/Simple.pm Thu Aug 31 13:45:15 2006
@@ -5,10 +5,9 @@
use Carp;
use vars qw($VERSION $GROUCHY);
-$VERSION = '1.96';
+$VERSION = '1.980';
my $crlf = qr/\x0a\x0d|\x0d\x0a|\x0a|\x0d/; # We are liberal in what we accept.
- # But then, so is a six dollar whore.
$GROUCHY = 0;
@@ -18,30 +17,25 @@
=head1 SYNOPSIS
- my $mail = Email::Simple->new($text);
-
- my $from_header = $mail->header("From");
- my @received = $mail->header("Received");
-
- $mail->header_set("From", 'Simon Cozens <simon at cpan.org>');
-
- my $old_body = $mail->body;
- $mail->body_set("Hello world\nSimon");
-
- print $mail->as_string;
-
- # AND THAT'S ALL.
+ my $email = Email::Simple->new($text);
+
+ my $from_header = $email->header("From");
+ my @received = $email->header("Received");
+
+ $email->header_set("From", 'Simon Cozens <simon at cpan.org>');
+
+ my $old_body = $email->body;
+ $email->body_set("Hello world\nSimon");
+
+ print $email->as_string;
=head1 DESCRIPTION
-C<Email::Simple> is the first deliverable of the "Perl Email Project", a
-reaction against the complexity and increasing bugginess of the
-C<Mail::*> modules. In contrast, C<Email::*> modules are meant to be
+C<Email::Simple> is the first deliverable of the "Perl Email Project." The
+Email:: namespace is a reaction against the complexity and increasing bugginess
+of the C<Mail::*> modules. In contrast, C<Email::*> modules are meant to be
simple to use and to maintain, pared to the bone, fast, minimal in their
external dependencies, and correct.
-
- Can you sum up plan 9 in layman's terms?
- It does everything Unix does only less reliably - kt
=head1 METHODS
@@ -103,7 +97,9 @@
# This is a continuation line. We fold it onto the end of
# the previous header.
chomp $head_hash->{$curhead}->[-1];
- $head_hash->{$curhead}->[-1] .= $head_hash->{$curhead}->[-1] ? " $_" : $_;
+ $head_hash->{$curhead}->[-1] .= $head_hash->{$curhead}->[-1]
+ ? " $_"
+ : $_;
} else {
$curhead = $1;
push @{$head_hash->{$curhead}}, $2;
@@ -115,11 +111,11 @@
=head2 header
-Returns a list of the contents of the given header.
-
-If called in scalar context, will return the B<first> header so named.
-I'm not sure I like that. Maybe it should always return a list. But it
-doesn't.
+ my @values = $email->header($header_name);
+ my $first = $email->header($header_name);
+
+In list context, this returns every value for the named header. In scalar
+context, it returns the I<first> value for the named header.
=cut
@@ -132,7 +128,7 @@
=head2 header_set
- $mail->header_set($field, $line1, $line2, ...);
+ $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.
@@ -160,6 +156,43 @@
return wantarray ? @data : $data[0];
}
+=head2 header_names
+
+ my @header_names = $email->header_names;
+
+This method returns the list of header names currently in the email object.
+These names can be passed to the C<header> method one-at-a-time to get header
+values. You are guaranteed to get a set of headers that are unique. You are not
+guaranteed to get the headers in any order at all.
+
+For backwards compatibility, this method can also be called as B<headers>.
+
+=cut
+
+sub header_names {
+ values %{ $_[0]->{header_names} }
+}
+BEGIN { *headers = \&header_names; }
+
+=head2 header_pairs
+
+ my @headers = $email->header_pairs;
+
+=cut
+
+sub header_pairs {
+ my ($self) = @_;
+
+ my @headers;
+ my %seen;
+
+ for my $header (@{$self->{order}}) {
+ push @headers, ($header, $self->{head}{$header}[ $seen{$header}++ ]);
+ }
+
+ return @headers;
+}
+
=head2 body
Returns the body text of the mail.
@@ -196,21 +229,19 @@
sub as_string {
my $self = shift;
- return _headers_as_string($self).$self->{mycrlf}.$self->body;
+ return $self->_headers_as_string
+ . $self->{mycrlf}
+ . $self->body;
}
sub _headers_as_string {
- my $self = shift;
- my @order = @{$self->{order}};
-
- my $header_str = "";
- my %seen;
-
- for my $header (@{$self->{order}}) {
- $header_str .= $self->_header_as_string(
- $header,
- $self->{head}{$header}[ $seen{$header}++ ]
- );
+ my ($self) = @_;
+
+ my $header_str = '';
+ my @pairs = $self->header_pairs;
+
+ while (my ($name, $value) = splice @pairs, 0, 2) {
+ $header_str .= $self->_header_as_string($name, $value);
}
return $header_str;
@@ -225,7 +256,7 @@
my $string = "$field: $data";
return (length $string > 78) ? $self->_fold($string)
- : "$string$self->{mycrlf}";
+ : ( $string . $self->{mycrlf} );
}
sub _fold {
@@ -240,7 +271,7 @@
$folded .= " " if $line;
} else {
# Basically nothing we can do. :(
- $folded .= $line;
+ $folded .= $line . $self->{mycrlf};
last;
}
}
Modified: packages/libemail-simple-perl/trunk/t/pod-coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libemail-simple-perl/trunk/t/pod-coverage.t?rev=3553&op=diff
==============================================================================
--- packages/libemail-simple-perl/trunk/t/pod-coverage.t (original)
+++ packages/libemail-simple-perl/trunk/t/pod-coverage.t Thu Aug 31 13:45:15 2006
@@ -6,5 +6,6 @@
if $@;
all_pod_coverage_ok({
- coverage_class => 'Pod::Coverage::CountParents'
+ coverage_class => 'Pod::Coverage::CountParents',
+ trustme => [ qw(headers) ],
});
More information about the Pkg-perl-cvs-commits
mailing list