r2383 - in packages: . libemail-simple-perl
libemail-simple-perl/branches libemail-simple-perl/branches/upstream
libemail-simple-perl/branches/upstream/current
libemail-simple-perl/branches/upstream/current/t
libemail-simple-perl/branches/upstream/current/t/test-mails
Krzysztof Krzyzaniak
eloy at costa.debian.org
Fri Mar 17 11:29:07 UTC 2006
Author: eloy
Date: 2006-03-17 11:27:20 +0000 (Fri, 17 Mar 2006)
New Revision: 2383
Added:
packages/libemail-simple-perl/
packages/libemail-simple-perl/branches/
packages/libemail-simple-perl/branches/upstream/
packages/libemail-simple-perl/branches/upstream/current/
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/Makefile.PL
packages/libemail-simple-perl/branches/upstream/current/README
packages/libemail-simple-perl/branches/upstream/current/Simple.pm
packages/libemail-simple-perl/branches/upstream/current/t/
packages/libemail-simple-perl/branches/upstream/current/t/1.t
packages/libemail-simple-perl/branches/upstream/current/t/2.t
packages/libemail-simple-perl/branches/upstream/current/t/3.t
packages/libemail-simple-perl/branches/upstream/current/t/4.t
packages/libemail-simple-perl/branches/upstream/current/t/test-mails/
packages/libemail-simple-perl/branches/upstream/current/t/test-mails/josey-fold
packages/libemail-simple-perl/branches/upstream/current/t/test-mails/josey-nofold
packages/libemail-simple-perl/branches/upstream/current/t/test-mails/long-msgid
packages/libemail-simple-perl/branches/upstream/current/t/unit.t
packages/libemail-simple-perl/tags/
Log:
[svn-inject] Installing original source of libemail-simple-perl
Added: packages/libemail-simple-perl/branches/upstream/current/Changes
===================================================================
--- packages/libemail-simple-perl/branches/upstream/current/Changes 2006-03-16 13:14:27 UTC (rev 2382)
+++ packages/libemail-simple-perl/branches/upstream/current/Changes 2006-03-17 11:27:20 UTC (rev 2383)
@@ -0,0 +1,41 @@
+Revision history for Perl extension Email::Simple.
+
+1.92 2004-11-11
+
+ - Update dependencies.
+ - Update test suite to support proper Test::More syntax.
+
+1.91 2004-10-27
+
+ - Tests use alarm(), skip those tests on MSWin32.
+ - body() is initialized to '' if it isn't defined.
+ - Author changes.
+
+1.9 Fix our own damned line-wrapping.
+
+1.8 Do our own damned line-wrapping
+
+1.7 Sample, don't assume, what CRLF we're using.
+ This means that mail with funny crlfs is round-trippable.
+
+1.61 fixes to test suite. there was a 5.6ish open my $fh which led to
+ test failures under 5.00503
+
+1.6 - fixes to test suite. We were using no_plan which fails on
+ older versions of Test::Harness
+
+1.5 - fixes more warnings during ->as_string calls
+
+ Documents more strongly that Email::Simple is intended for use
+ with RFC2822 messages only
+
+1.4 - fixes a warning emitted during ->as_string calls
+ fix for header unfolding
+1.3 - Many fixes from Richard Clamp <richardc at unixbeard.net>
+1.2 - Text::Wrapper->Text::Wrap
+
+0.01 Thu Feb 13 15:07:01 2003
+ - original version; created by h2xs 1.22 with options
+ -b 5.5.3 -AX -n Email::Simple
+
+Full details are available at http://cvs.simon-cozens.org/
Added: packages/libemail-simple-perl/branches/upstream/current/MANIFEST
===================================================================
--- packages/libemail-simple-perl/branches/upstream/current/MANIFEST 2006-03-16 13:14:27 UTC (rev 2382)
+++ packages/libemail-simple-perl/branches/upstream/current/MANIFEST 2006-03-17 11:27:20 UTC (rev 2383)
@@ -0,0 +1,14 @@
+Changes
+Makefile.PL
+MANIFEST
+README
+Simple.pm
+t/1.t
+t/2.t
+t/3.t
+t/4.t
+t/test-mails/josey-fold
+t/test-mails/josey-nofold
+t/test-mails/long-msgid
+t/unit.t
+META.yml Module meta-data (added by MakeMaker)
Added: packages/libemail-simple-perl/branches/upstream/current/META.yml
===================================================================
--- packages/libemail-simple-perl/branches/upstream/current/META.yml 2006-03-16 13:14:27 UTC (rev 2382)
+++ packages/libemail-simple-perl/branches/upstream/current/META.yml 2006-03-17 11:27:20 UTC (rev 2383)
@@ -0,0 +1,11 @@
+# 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.92
+version_from: Simple.pm
+installdirs: site
+requires:
+ Test::More: 0.47
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17
Added: packages/libemail-simple-perl/branches/upstream/current/Makefile.PL
===================================================================
--- packages/libemail-simple-perl/branches/upstream/current/Makefile.PL 2006-03-16 13:14:27 UTC (rev 2382)
+++ packages/libemail-simple-perl/branches/upstream/current/Makefile.PL 2006-03-17 11:27:20 UTC (rev 2383)
@@ -0,0 +1,9 @@
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'Email::Simple',
+ VERSION_FROM => 'Simple.pm',
+ PREREQ_PM => {
+ 'Test::More' => '0.47',
+ },
+);
Added: packages/libemail-simple-perl/branches/upstream/current/README
===================================================================
--- packages/libemail-simple-perl/branches/upstream/current/README 2006-03-16 13:14:27 UTC (rev 2382)
+++ packages/libemail-simple-perl/branches/upstream/current/README 2006-03-17 11:27:20 UTC (rev 2383)
@@ -0,0 +1,84 @@
+NAME
+ Email::Simple - Simple parsing of RFC2822 message format and headers
+
+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.
+
+DESCRIPTION
+ "Email::Simple" is the first deliverable of the "Perl Email Project", a
+ reaction against the complexity and increasing bugginess of the
+ "Mail::*" modules. In contrast, "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
+
+METHODS
+ Methods are deliberately kept to a minimum. This is meant to be simple.
+ No, I will not add method X. This is meant to be simple. Why doesn't it
+ have feature Y? Because it's meant to be simple.
+
+ new
+ Parse an email from a scalar containing an RFC2822 formatted message,
+ and return an object.
+
+header
+ Returns a list of the contents of the given header.
+
+ If called in scalar context, will return the first header so named. I'm
+ not sure I like that. Maybe it should always return a list. But it
+ doesn't.
+
+ header_set
+ $mail->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.
+
+ body
+ Returns the body text of the mail.
+
+ body_set
+ Sets the body text of the mail.
+
+ as_string
+ Returns the mail as a string, reconstructing the headers. Please note
+ that header fields are kept in order if they are unique, but, for,
+ instance, multiple "Received" headers will be grouped together. (This is
+ in accordance with RFC2822, honest.)
+
+ Also, if you've added new headers with "header_set" that weren't in the
+ original mail, they'll be added to the end.
+
+CAVEATS
+ Email::Simple handles only RFC2822 formatted messages. This means you
+ cannot expect it to cope well as the only parser between you and the
+ outside world, say for example when writing a mail filter for invocation
+ from a .forward file (for this we recommend you use Email::Filter
+ anyway). For more information on this issue please consult RT issue
+ 2478, http://rt.cpan.org/NoAuth/Bug.html?id=2478 .
+
+COPYRIGHT AND LICENSE
+ Copyright 2004 by Casey West
+
+ Copyright 2003 by Simon Cozens
+
+ This library is free software; you can redistribute it and/or modify it
+ under the same terms as Perl itself.
+
+SEE ALSO
+ Perl Email Project, http://pep.kwiki.org .
+
Added: packages/libemail-simple-perl/branches/upstream/current/Simple.pm
===================================================================
--- packages/libemail-simple-perl/branches/upstream/current/Simple.pm 2006-03-16 13:14:27 UTC (rev 2382)
+++ packages/libemail-simple-perl/branches/upstream/current/Simple.pm 2006-03-17 11:27:20 UTC (rev 2383)
@@ -0,0 +1,271 @@
+package Email::Simple;
+
+use 5.00503;
+use strict;
+use Carp;
+
+use vars qw($VERSION $GROUCHY);
+$VERSION = '1.92';
+
+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;
+
+=head1 NAME
+
+Email::Simple - Simple parsing of RFC2822 message format and headers
+
+=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.
+
+=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
+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
+
+Methods are deliberately kept to a minimum. This is meant to be simple.
+No, I will not add method X. This is meant to be simple. Why doesn't it
+have feature Y? Because it's meant to be simple.
+
+=head2 new
+
+Parse an email from a scalar containing an RFC2822 formatted message,
+and return an object.
+
+=cut
+
+sub new {
+ my ($class, $text) = @_;
+ my ($head, $body, $mycrlf) = _split_head_from_body($text);
+ my ($head_hash, $order) = _read_headers($head);
+ bless {
+ head => $head_hash,
+ body => $body,
+ order => $order,
+ mycrlf => $mycrlf,
+ header_names => { map { lc $_ => $_ } keys %$head_hash }
+ }, $class;
+}
+
+sub _split_head_from_body {
+ my $text = shift;
+ # The body is simply a sequence of characters that
+ # follows the header and is separated from the header by an empty
+ # line (i.e., a line with nothing preceding the CRLF).
+ # - RFC 2822, section 2.1
+ if ($text =~ /(.*?($crlf))\2(.*)/sm) {
+ return ($1, ($3 || ''), $2);
+ } else { # The body is, of course, optional.
+ return ($text, "", "\n");
+ }
+}
+
+# Header fields are lines composed of a field name, followed by a colon
+# (":"), followed by a field body, and terminated by CRLF. A field
+# name MUST be composed of printable US-ASCII characters (i.e.,
+# characters that have values between 33 and 126, inclusive), except
+# colon. A field body may be composed of any US-ASCII characters,
+# except for CR and LF.
+
+# However, a field body may contain CRLF when
+# used in header "folding" and "unfolding" as described in section
+# 2.2.3.
+
+sub _read_headers {
+ my $head = shift;
+ my @head_order;
+ my ($curhead, $head_hash) = ("", {});
+ for (split /$crlf/, $head) {
+ if (s/^\s+// or not /^([^:]+):\s*(.*)/) {
+ next if !$curhead; # Well, that sucks.
+ # 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] ? " $_" : $_;
+ } else {
+ $curhead = $1;
+ push @{$head_hash->{$curhead}}, $2;
+ push @head_order, $curhead;
+ }
+ }
+ return ($head_hash, \@head_order);
+}
+
+=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.
+
+=cut
+
+sub header {
+ my ($self, $field) = @_;
+ $field = $self->{header_names}->{lc $field} || return "";
+ return wantarray ? @{$self->{head}->{$field}}
+ : $self->{head}->{$field}->[0];
+}
+
+=head2 header_set
+
+ $mail->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.
+
+=cut
+
+sub header_set {
+ my ($self, $field, @data) = @_;
+ if ($GROUCHY) {
+ croak "I am not going to break RFC2822 and neither are you"
+ unless $field =~ /^[\x21-\x39\x3b-\x7e]+$/;
+ carp "You're a miserable bastard but I'll let you off this time"
+ unless $field =~ /^[\w-]+$/;
+ }
+
+ if (!exists $self->{header_names}->{lc $field}) {
+ $self->{header_names}->{lc $field} = $field;
+ # New fields are added to the end.
+ push @{$self->{order}}, $field;
+ } else {
+ $field = $self->{header_names}->{lc $field};
+ }
+
+ $self->{head}->{$field} = [ @data ];
+ return wantarray ? @data : $data[0];
+}
+
+=head2 body
+
+Returns the body text of the mail.
+
+=cut
+
+sub body { return $_[0]->{body} } # We like this. This is simple.
+
+=head2 body_set
+
+Sets the body text of the mail.
+
+=cut
+
+sub body_set { $_[0]->{body} = $_[1] || '' }
+
+=head2 as_string
+
+Returns the mail as a string, reconstructing the headers. Please note
+that header fields are kept in order if they are unique, but, for,
+instance, multiple "Received" headers will be grouped together. (This is
+in accordance with RFC2822, honest.)
+
+Also, if you've added new headers with C<header_set> that weren't in the
+original mail, they'll be added to the end.
+
+=cut
+
+# However, for the purposes of this standard, header
+# fields SHOULD NOT be reordered when a message is transported or
+# transformed. More importantly, the trace header fields and resent
+# header fields MUST NOT be reordered, and SHOULD be kept in blocks
+# prepended to the message.
+
+sub as_string {
+ my $self = shift;
+ return _headers_as_string($self).$self->{mycrlf}.$self->body;
+}
+
+sub _headers_as_string {
+ my $self = shift;
+ my @order = @{$self->{order}};
+ my %head = %{$self->{head}};
+ my $stuff = "";
+ while (keys %head) {
+ my $thing = shift @order;
+ next unless exists $head{$thing}; # We have already dealt with it
+ $stuff .= $self->_header_as_string($thing, $head{$thing});
+ delete $head{$thing};
+ }
+ return $stuff;
+}
+
+sub _header_as_string {
+ my ($self, $field, $data) = @_;
+ my @stuff = @$data;
+ # Ignore "empty" headers
+ return '' unless @stuff = grep { defined $_ } @stuff;
+ return join "", map { $_ = "$field: $_$self->{mycrlf}";
+ length > 78 ? $self->_fold($_) : $_ }
+ @stuff;
+}
+
+sub _fold {
+ my $self = shift;
+ my $line = shift;
+ # We know it will not contain any new lines at present
+ my $folded = "";
+ while ($line) {
+ $line =~ s/^\s+//;
+ if ($line =~ s/^(.{0,77})(\s|\z)//) {
+ $folded .= $1.$self->{mycrlf};
+ $folded .= " " if $line;
+ } else {
+ # Basically nothing we can do. :(
+ $folded .= $line;
+ last;
+ }
+ }
+ return $folded;
+}
+
+1;
+
+__END__
+
+=head1 CAVEATS
+
+Email::Simple handles only RFC2822 formatted messages. This means you
+cannot expect it to cope well as the only parser between you and the
+outside world, say for example when writing a mail filter for
+invocation from a .forward file (for this we recommend you use
+L<Email::Filter> anyway). For more information on this issue please
+consult RT issue 2478, http://rt.cpan.org/NoAuth/Bug.html?id=2478 .
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2004 by Casey West
+
+Copyright 2003 by Simon Cozens
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+Perl Email Project, http://pep.kwiki.org .
+
+=cut
Added: packages/libemail-simple-perl/branches/upstream/current/t/1.t
===================================================================
--- packages/libemail-simple-perl/branches/upstream/current/t/1.t 2006-03-16 13:14:27 UTC (rev 2382)
+++ packages/libemail-simple-perl/branches/upstream/current/t/1.t 2006-03-17 11:27:20 UTC (rev 2383)
@@ -0,0 +1,44 @@
+#!/usr/bin/perl -w
+use strict;
+use Test::More tests => 13;
+
+sub read_file { local $/; local *FH; open FH, shift or die $!; return <FH> }
+use_ok("Email::Simple");
+# Very basic functionality test
+my $mail_text = read_file("t/test-mails/josey-nofold");
+my $mail = Email::Simple->new($mail_text);
+isa_ok($mail, "Email::Simple");
+
+like($mail->{head}->{From}->[0], qr/Andrew/, "Andrew's in the header");
+
+my $old_from;
+is($old_from = $mail->header("From"),
+ 'Andrew Josey <ajosey at rdg.opengroup.org>',
+ "We can get a header");
+my $sc = 'Simon Cozens <simon at cpan.org>';
+is($mail->header_set("From", $sc), $sc, "Setting returns new value");
+is($mail->header("From"), $sc, "Which is consistently returned");
+
+# Put andrew back:
+$mail->header_set("From", $old_from);
+
+my $body;
+like($body = $mail->body, qr/Austin Group Chair/, "Body has sane stuff in it");
+my $old_body;
+
+my $hi = "Hi there!\n";
+$mail->body_set($hi);
+is($mail->body, $hi, "Body can be set properly");
+
+$mail->body_set($body);
+is($mail->as_string, $mail_text, "Good grief, it's round-trippable");
+is(Email::Simple->new($mail->as_string)->as_string, $mail_text, "Good grief, it's still round-trippable");
+
+# With nasty newlines
+my $nasty = "Subject: test\n\rTo: foo\n\r\n\rfoo\n\r";
+$mail = Email::Simple->new($nasty);
+my ($x,$y) = Email::Simple::_split_head_from_body($nasty);
+is ($x, "Subject: test\n\rTo: foo\n\r", "Can split head OK");
+my $test = $mail->as_string;
+is($test, $nasty, "Round trip that too");
+is(Email::Simple->new($mail->as_string)->as_string, $nasty, "... twice");
Added: packages/libemail-simple-perl/branches/upstream/current/t/2.t
===================================================================
--- packages/libemail-simple-perl/branches/upstream/current/t/2.t 2006-03-16 13:14:27 UTC (rev 2382)
+++ packages/libemail-simple-perl/branches/upstream/current/t/2.t 2006-03-17 11:27:20 UTC (rev 2383)
@@ -0,0 +1,24 @@
+#!perl -w
+use strict;
+use Test::More tests => 5;
+
+# This time, with folding!
+
+use_ok("Email::Simple");
+sub read_file { local $/; local *FH; open FH, shift or die $!; return <FH> }
+
+my $mail_text = read_file("t/test-mails/josey-fold");
+
+my $mail = Email::Simple->new($mail_text);
+isa_ok($mail, "Email::Simple");
+is($mail->header("References"),
+ q{<200211120937.JAA28130 at xoneweb.opengroup.org> <1021112125524.ZM7503 at skye.rdg.opengroup.org> <3DD221BB.13116D47 at sun.com>},
+ "References header checks out");
+is($mail->header("reFerEnceS"),
+ q{<200211120937.JAA28130 at xoneweb.opengroup.org> <1021112125524.ZM7503 at skye.rdg.opengroup.org> <3DD221BB.13116D47 at sun.com>},
+ "References header checks out with case folding");
+is_deeply([$mail->header("Received")],
+[
+'from mailman.opengroup.org ([192.153.166.9]) by deep-dark-truthful-mirror.pad with smtp (Exim 3.36 #1 (Debian)) id 18Buh5-0006Zr-00 for <posix at simon-cozens.org>; Wed, 13 Nov 2002 10:24:23 +0000',
+'(qmail 1679 invoked by uid 503); 13 Nov 2002 10:10:49 -0000'],
+"And the received headers are folded gracefully, and multiple headers work");
Added: packages/libemail-simple-perl/branches/upstream/current/t/3.t
===================================================================
--- packages/libemail-simple-perl/branches/upstream/current/t/3.t 2006-03-16 13:14:27 UTC (rev 2382)
+++ packages/libemail-simple-perl/branches/upstream/current/t/3.t 2006-03-17 11:27:20 UTC (rev 2383)
@@ -0,0 +1,10 @@
+use Test::More tests => 1;
+use Email::Simple;
+
+my $m = Email::Simple->new("Foo-Bar: Baz\n\ntest\n");
+$m->header_set("Foo-bar", "quux");
+is($m->as_string, "Foo-Bar: quux
+
+test\n", "Only one header this time");
+
+
Added: packages/libemail-simple-perl/branches/upstream/current/t/4.t
===================================================================
--- packages/libemail-simple-perl/branches/upstream/current/t/4.t 2006-03-16 13:14:27 UTC (rev 2382)
+++ packages/libemail-simple-perl/branches/upstream/current/t/4.t 2006-03-17 11:27:20 UTC (rev 2383)
@@ -0,0 +1,19 @@
+#!perl -w
+use strict;
+use Test::More tests => 3;
+
+# This time, with folding!
+
+use_ok("Email::Simple");
+sub read_file { local $/; local *FH; open FH, shift or die $!; return <FH> }
+
+my $mail_text = read_file("t/test-mails/long-msgid");
+
+my $mail = Email::Simple->new($mail_text);
+isa_ok($mail, "Email::Simple");
+
+SKIP: {
+ skip "no alarm() on win32", 1 if $^O =~ /mswin32/i;
+ alarm 5;
+ ok($mail->as_string(), "Doesn't hang");
+};
Added: packages/libemail-simple-perl/branches/upstream/current/t/test-mails/josey-fold
===================================================================
--- packages/libemail-simple-perl/branches/upstream/current/t/test-mails/josey-fold 2006-03-16 13:14:27 UTC (rev 2382)
+++ packages/libemail-simple-perl/branches/upstream/current/t/test-mails/josey-fold 2006-03-17 11:27:20 UTC (rev 2383)
@@ -0,0 +1,106 @@
+From mail-miner-10529 at localhost Wed Dec 18 12:07:55 2002
+Received: from mailman.opengroup.org ([192.153.166.9])
+ by deep-dark-truthful-mirror.pad with smtp (Exim 3.36 #1 (Debian))
+ id 18Buh5-0006Zr-00
+ for <posix at simon-cozens.org>; Wed, 13 Nov 2002 10:24:23 +0000
+Received: (qmail 1679 invoked by uid 503); 13 Nov 2002 10:10:49 -0000
+Resent-Date: 13 Nov 2002 10:10:49 -0000
+Date: Wed, 13 Nov 2002 10:06:51 GMT
+From: Andrew Josey <ajosey at rdg.opengroup.org>
+Message-Id: <1021113100650.ZM12997 at skye.rdg.opengroup.org>
+In-Reply-To: Joanna Farley's message as of Nov 13, 9:56am.
+References:
+ <200211120937.JAA28130 at xoneweb.opengroup.org>
+ <1021112125524.ZM7503 at skye.rdg.opengroup.org>
+ <3DD221BB.13116D47 at sun.com>
+X-Mailer: Z-Mail (5.0.0 30July97)
+To: austin-group-l at opengroup.org
+Subject: Re: Defect in XBD lround
+MIME-Version: 1.0
+Resent-Message-ID: <gZGK1B.A.uY.iUi09 at mailman>
+Resent-To: austin-group-l at opengroup.org
+Resent-From: austin-group-l at opengroup.org
+X-Mailing-List: austin-group-l:archive/latest/4823
+X-Loop: austin-group-l at opengroup.org
+Precedence: list
+Resent-Sender: austin-group-l-request at opengroup.org
+Content-Type: text/plain; charset=us-ascii
+
+Joanna, All
+
+Thanks. I got the following response from Fred Tydeman.
+
+C99 Defect Report (DR) 240 covers this. The main body of C99
+(7.12.9.7) says range error, while Annex F (F.9.6.7 and F.9.6.5)
+says "invalid" (domain error). The result was to change 7.12.9.7
+to allow for either range or domain error. The preferred error
+is domain error (so as match Annex F). So, no need to change XBD.
+
+regards
+Andrew
+
+On Nov 13, 9:56am in "Re: Defect in XBD lr", Joanna Farley wrote:
+> Sun's expert in this area after some discussions with a colleague
+> outside of Sun concluded that for lround, to align with both C99 and SUS
+> changes of the following form were necessary:
+>
+> + If x is +/-Inf/NaN, a domain error occurs, and
+> + errno is set to EDOM in MATH_ERRNO mode;
+> + the invalid exception is raised in MATH_ERREXCEPT mode.
+> [to align with C99 Annex F.4]
+>
+> + If x is too large to be represented as a long, a *range* error
+> may occur, and
+> + errno *may be* set to ERANGE in MATH_ERRNO mode;
+> [to align with C99 7.12.9.7]
+> + the invalid exception *is* raised in MATH_ERREXCEPT mode.
+> [to align with C99 Annex F.4]
+>
+> They believe it is a bit awkward to have errno set to ERANGE in
+> MATH_ERRNO mode yet the invalid exception raised in MAH_ERREXCEPT mode,
+> but that just reflects an imperfect mapping of the C notion of errno to
+> the IEEE 754 notion of data conversion.
+>
+> I'll work with our expert to draft text refecting the above to suggest
+> replacement text for lines 23678-23684 on lround page 721 of XSH6.
+>
+> Thanks
+>
+> Joanna
+>
+>
+> Andrew Josey wrote:
+> >
+> > The text referred to is MX shaded and part of the ISO 60559 floating
+> > point option. I do not think changing the Domain Error to a Range Error
+> > is the fix or at least not the fix for the NaN and +-Inf cases. ISO C
+> > 99 describes the range error case if the magnitude of x is too large as a
+> > may fail. I'll ask Fred T for his thoughts on this one...
+> > regards
+> > Andrew
+> >
+> > On Nov 12, 9:37am in "Defect in XBD lround", Erwin.Unruh at fujitsu-siemens.com wrote:
+> > > Defect report from : Erwin Unruh , Fujitsu Siemens Computers
+> > >
+> > > (Please direct followup comments direct to austin-group-l at opengroup.org)
+> > >
+> > > @ page 0 line 0 section lround objection {0}
+> > >
+> > > Problem:
+> > >
+> > > Defect code : 1. Error
+> > >
+> > > The function lround is described in http://www.opengroup.org/onlinepubs/007904975/functions/lround.html
+> > > On Error it is specified that errno has to be set to EDOM. However, the C99 standard ISO/IEC 9899:1999 (E) specifies this as a range error, which would result in a value of ERANGE. So an implementation could not be conformant to both these standards.
+> > >
+> > > Action:
+> > >
+> > > Change the value of errno to ERANGE, if the result is not represantable. More specific: In the description of the function, replace all occurences of "domain error" with "range error" and replace "EDOM" with "ERANGE"
+> > >-- End of excerpt from Erwin.Unruh at fujitsu-siemens.com
+> >
+
+-----
+Andrew Josey The Open Group
+Austin Group Chair Apex Plaza,Forbury Road,
+Email: a.josey at opengroup.org Reading,Berks.RG1 1AX,England
+Tel: +44 118 9508311 ext 2250 Fax: +44 118 9500110
Added: packages/libemail-simple-perl/branches/upstream/current/t/test-mails/josey-nofold
===================================================================
--- packages/libemail-simple-perl/branches/upstream/current/t/test-mails/josey-nofold 2006-03-16 13:14:27 UTC (rev 2382)
+++ packages/libemail-simple-perl/branches/upstream/current/t/test-mails/josey-nofold 2006-03-17 11:27:20 UTC (rev 2383)
@@ -0,0 +1,97 @@
+Received: (qmail 1679 invoked by uid 503); 13 Nov 2002 10:10:49 -0000
+Resent-Date: 13 Nov 2002 10:10:49 -0000
+Date: Wed, 13 Nov 2002 10:06:51 GMT
+From: Andrew Josey <ajosey at rdg.opengroup.org>
+Message-Id: <1021113100650.ZM12997 at skye.rdg.opengroup.org>
+In-Reply-To: Joanna Farley's message as of Nov 13, 9:56am.
+X-Mailer: Z-Mail (5.0.0 30July97)
+To: austin-group-l at opengroup.org
+Subject: Re: Defect in XBD lround
+MIME-Version: 1.0
+Resent-Message-ID: <gZGK1B.A.uY.iUi09 at mailman>
+Resent-To: austin-group-l at opengroup.org
+Resent-From: austin-group-l at opengroup.org
+X-Mailing-List: austin-group-l:archive/latest/4823
+X-Loop: austin-group-l at opengroup.org
+Precedence: list
+Resent-Sender: austin-group-l-request at opengroup.org
+Content-Type: text/plain; charset=us-ascii
+
+Joanna, All
+
+Thanks. I got the following response from Fred Tydeman.
+
+C99 Defect Report (DR) 240 covers this. The main body of C99
+(7.12.9.7) says range error, while Annex F (F.9.6.7 and F.9.6.5)
+says "invalid" (domain error). The result was to change 7.12.9.7
+to allow for either range or domain error. The preferred error
+is domain error (so as match Annex F). So, no need to change XBD.
+
+regards
+Andrew
+
+On Nov 13, 9:56am in "Re: Defect in XBD lr", Joanna Farley wrote:
+> Sun's expert in this area after some discussions with a colleague
+> outside of Sun concluded that for lround, to align with both C99 and SUS
+> changes of the following form were necessary:
+>
+> + If x is +/-Inf/NaN, a domain error occurs, and
+> + errno is set to EDOM in MATH_ERRNO mode;
+> + the invalid exception is raised in MATH_ERREXCEPT mode.
+> [to align with C99 Annex F.4]
+>
+> + If x is too large to be represented as a long, a *range* error
+> may occur, and
+> + errno *may be* set to ERANGE in MATH_ERRNO mode;
+> [to align with C99 7.12.9.7]
+> + the invalid exception *is* raised in MATH_ERREXCEPT mode.
+> [to align with C99 Annex F.4]
+>
+> They believe it is a bit awkward to have errno set to ERANGE in
+> MATH_ERRNO mode yet the invalid exception raised in MAH_ERREXCEPT mode,
+> but that just reflects an imperfect mapping of the C notion of errno to
+> the IEEE 754 notion of data conversion.
+>
+> I'll work with our expert to draft text refecting the above to suggest
+> replacement text for lines 23678-23684 on lround page 721 of XSH6.
+>
+> Thanks
+>
+> Joanna
+>
+>
+> Andrew Josey wrote:
+> >
+> > The text referred to is MX shaded and part of the ISO 60559 floating
+> > point option. I do not think changing the Domain Error to a Range Error
+> > is the fix or at least not the fix for the NaN and +-Inf cases. ISO C
+> > 99 describes the range error case if the magnitude of x is too large as a
+> > may fail. I'll ask Fred T for his thoughts on this one...
+> > regards
+> > Andrew
+> >
+> > On Nov 12, 9:37am in "Defect in XBD lround", Erwin.Unruh at fujitsu-siemens.com wrote:
+> > > Defect report from : Erwin Unruh , Fujitsu Siemens Computers
+> > >
+> > > (Please direct followup comments direct to austin-group-l at opengroup.org)
+> > >
+> > > @ page 0 line 0 section lround objection {0}
+> > >
+> > > Problem:
+> > >
+> > > Defect code : 1. Error
+> > >
+> > > The function lround is described in http://www.opengroup.org/onlinepubs/007904975/functions/lround.html
+> > > On Error it is specified that errno has to be set to EDOM. However, the C99 standard ISO/IEC 9899:1999 (E) specifies this as a range error, which would result in a value of ERANGE. So an implementation could not be conformant to both these standards.
+> > >
+> > > Action:
+> > >
+> > > Change the value of errno to ERANGE, if the result is not represantable. More specific: In the description of the function, replace all occurences of "domain error" with "range error" and replace "EDOM" with "ERANGE"
+> > >-- End of excerpt from Erwin.Unruh at fujitsu-siemens.com
+> >
+
+-----
+Andrew Josey The Open Group
+Austin Group Chair Apex Plaza,Forbury Road,
+Email: a.josey at opengroup.org Reading,Berks.RG1 1AX,England
+Tel: +44 118 9508311 ext 2250 Fax: +44 118 9500110
Added: packages/libemail-simple-perl/branches/upstream/current/t/test-mails/long-msgid
===================================================================
--- packages/libemail-simple-perl/branches/upstream/current/t/test-mails/long-msgid 2006-03-16 13:14:27 UTC (rev 2382)
+++ packages/libemail-simple-perl/branches/upstream/current/t/test-mails/long-msgid 2006-03-17 11:27:20 UTC (rev 2383)
@@ -0,0 +1,217 @@
+Received: from ls2.sba.com ([206.69.91.6]:22703 helo=ls.sba.com)
+ by smtp.paravolve.net with smtp (Exim 4.34)
+ id 1BTp3v-0007sJ-Pj
+ for jwb at paravolve.net; Fri, 28 May 2004 21:38:49 +0000
+From: Encompass <information at encompassus.org>
+To: jwb at paravolve.net
+Subject: Encompass Points - May 2004
+Date: Fri, 28 May 2004 16:02:19 -0500
+MIME-Version: 1.0
+Content-Type: text/plain;
+ charset="iso-8859-1"
+Content-Transfer-Encoding: 8bit
+List-Unsubscribe: <mailto:leave-encompass_points-7842440G at ls.encompassus.org>
+Message-Id: <LYRIS-7842440-223299-2004.05.28-16.02.21--jwb#paravolve.net at ls.encompassus.org>
+X-ParaVolve-Scan-Signature: 85328c83c550adce6a970aeb2e21d0bc
+X-ParaVolve-Spam-Score: 0.0, (/)
+
+_Encompass Points_
+
+Issue 17, May 2004
+
+Thank you for subscribing to the newsletter _Encompass Points_!
+
+To view this publication online, go to
+http://www.encompassUS.org/news/points/index.html.
+
+Encompass Points is a monthly e-mail newsletter for Encompass, an
+independent, volunteer-driven organization providing HP users with
+opportunities for education, peer networking and vendor advocacy.
+
+Issue Contents:
+* HP World 2004 Heats Up With Hot Topics For the HP IT Community
+* Encompass 2004 Board of Directors Election
+* Webcasts Sponsored by Encompass and MindIQ Another Success
+* Sign Up For the Next Encompass and MindIQ Webcast
+* Sign Up for HP's Webcast
+* Encompass Local User Group News
+* Encompass Special Interest Groups
+* HP Customer News - Ready For You
+* Events Calendar
+* We Want Your Feedback and Submissions
+
+
+HP WORLD 2004 HEATS UP WITH HOT TOPICS FOR THE HP IT COMMUNITY
+HP World 2004 promises to offer a wide-ranging technical program covering
+today's hottest topics for HP customers and users. For the second
+consecutive year, the Encompass and Interex user communities have joined
+forces to bring you an opportunity-rich agenda of education, new product
+information, and peer networking.
+
+Join more than 7,000 of your colleagues from the HP IT community at this,
+the largest HP-focused technology conference in the Americas!
+
+Registration is now open with an "early bird" savings of $100 for
+registrations received by July 23. Encompass members qualify for an
+additional savings of $200. Find out more at http://www.hpworld.com/.
+
+Along with the 400+ technical sessions offered, the following is a sample
+of some of the technical information you'll find at HP World 2004:
+- Adaptive Enterprise - Find out more about HP's Adaptive Enterprise
+vision and how to apply various technologies toward making your
+enterprise
+more adaptive.
+- Storage - Benefit from an introduction to storage area networks.
+- HP-UX - Listen to a panel on HP-UX performance and a discussion of
+future directions.
+- Tru64 - Find out about HP's road map for integrating Tru64
+functionality into HP-UX.
+- OpenVMS - Hear from a panel of engineering experts and get a technical
+update.
+- Linux - Hear actual case studies and gather "how-tos" for building
+Linux distribution.
+- Itanium - Learn about real-world experiences porting to Itanium, and
+take a look at HP's future Itanium plans.
+- Security - Witness a live hacking demo and learn how the super spies
+compromise security.
+- High Availability and Disaster Recovery - Hear a discussion of trends
+and best practices.
+- IA32 - Learn about ProLiant Clusters and how to put blade servers to
+effective use.
+- Networking - Get practical advice about troubleshooting and anti-spam
+solutions.
+- Windows - Learn about Windows 2003 and see a cost comparison of
+Windows and Linux.
+- MPE - Arm yourself with strategies for migrating from HP e3000-based
+applications to other platforms.
+
+For complete program details, visit http://www.hpworld.com/. Be sure to
+check back often for updates. And watch your e-mail inbox for more about
+the information-rich programs, training seminars, and workshops that will
+be offered at HP World 2004.
+
+ENCOMPASS 2004 BOARD OF DIRECTORS ELECTION
+The deadline for the Encompass Board of Directors Election Call for
+Candidates is fast approaching! All individual and corporate members in
+good standing are eligible to run for the Encompass Board of Directors. If
+you are interested in being a part of the leadership of Encompass, please
+go to http://www.encompassUS.org/elections.html and submit your
+application for candidacy by June 4, 2004 to
+mailto:elections at encompassUS.org.
+
+WEBCAST SPONSORED BY ENCOMPASS AND MINDIQ ANOTHER SUCCESS
+On April 15, Peter Sward from HP presented on the transition from Tru64
+UNIX to HP-UX in the free Encompass and MindIQ webcast.
+
+The free webcast focused on the tools that HP is developing to assist
+customers with the transition of their home-grown applications from Tru64
+UNIX to HP-UX on Itanium-based systems.
+
+SIGN UP FOR THE NEXT ENCOMPASS AND MIND IQ WEBCAST
+On June 10, James Percent, Software Engineer in the Enterprise UNIX
+Division at HP, will present "Selecting the Most Appropriate Cluster Interconnect Technology for a TruCluster Deployment".
+
+The free webcast will provide practical information regarding the impacts
+of the cluster interconnect upon overall application availability,
+scalability, and performance in a TruCluster Server environment.
+
+To register for this webcast offering, visit
+http://www.encompassUS.org/events/webcasts.html.
+
+SIGN UP FOR HP'S WEBCAST
+Sign-up for the June 15th HP webcast entitled "Using Intel Compilers
+to Best Extract Performance from Itanium 2-based Platforms Webcast."
+The webcast will cover the benefits of using threading tools to improve
+your development efforts. Shine a brilliant spotlight on the unseen
+internal behavior of your multithreaded application with the debugging
+and
+analysis tools. Easily navigate the threads and synchronization objects in your application with complete correlation back to the source code.
+
+After attending this event you should understand the capabilities of the
+Visual Threads debugging and analysis tool, and be able to easily apply
+it
+to your multithreaded application. You will be able to improve the
+robustness of your application, identify potential performance
+bottlenecks, and explore the previously unseen behavior of your
+application as it executes.
+
+For more information and to register go to:
+http://h21007.www2.hp.com/dspp/ne/ne_EventDetail_IDX/1,1394,723,00.html
+
+ENCOMPASS LOCAL USER GROUP NEWS
+"ESILUG, an Encompass Local User Group in the Washington, DC area will
+meet on Tuesday, June 1, from 1-4pm. We'll be taking a practical look at
+the tools that aid Windows server consolidation. Dennis Bonanni of HP
+will
+share his experiences and knowledge of ways to consolidate Windows
+servers
+effectively. Pete Nash of Microsoft will describe the Microsoft Virtual
+Server product. To register and to find out more, see
+http://encompasserve.org/lugs/esilug/."
+
+Local User Groups (LUGs) are a key part of the Encompass community. There
+are many Encompass LUGs which offer members an opportunity to interact
+with fellow IT professionals face-to-face, close to home. These LUGS host
+local meetings and events that allow customers to stay connected with HP
+developments. Become involved with a user group in your area to interact
+directly with others in a friendly, familiar forum. To find a LUG in your
+area visit http://www.encompassUS.org/community/LUGS/
+
+
+ENCOMPASS SPECIAL INTEREST GROUPS (SIGS)
+Take advantage of the direct customer contact Encompass Special Interest
+Groups (SIGs) offer you. SIGs are recognized forums where HP users, with
+a
+vested interest in enterprise computing, exchange ideas and discuss
+technologies. Organized by Encompass members, SIG members meet annually
+at
+the annual conference and interact weekly via mailing lists. You are
+invited to join one of the four SIGS: Linux SIG, Enterprise Unix,
+OpenVMS,
+and Enterprise Storage at
+http://www.encompassUS.org/community/sigs/sigjoin.html.
+
+HP CUSTOMER NEWS - READY FOR YOU
+Have you read HP's 'Customer Times'?
+[http://www.hp.com/products1/evolution/customertimes/index.html] It's a
+storage and server newsletter brimming with stories of interest for HP's
+worldwide customers. It's available now in two easy versions: online (html) and print-ready (pdf).
+
+'Customer Times' provides you with news updates from across the whole
+spectrum of HP offerings, including OpenVMS, Tru64 UNIX, HP-UX, Linux and
+more. It's simple to become a quarterly subscriber, too. Register now at
+http://www.hp.com/products1/evolution/customertimes/customertimes_reg.html!
+
+EVENTS CALENDAR
+Encompass and HP community events are promoted via an online events
+calendar at http://www.encompassUS.org/calendar/index.cfm Check this
+calendar on a regular basis to learn about upcoming Encompass events.
+Forward calendar posting requests to information at encompassUS.org.
+
+
+WE WANT YOUR FEEDBACK AND SUBMISSIONS
+Is there something you'd like to see in Encompass Points? Let us know.
+If you have news, updates or something special you'd like to let the
+Encompass community know, please send to information at encompassUS.org.
+* * *
+
+Interested in advertising? E-mail information at encompassUS.org.
+
+Previous issues of Encompass Points are available in the online archives.
+Access them at http://www.encompassUS.org/members/points_archive/.
+
+
+* * *
+
+How to Avoid Missing our Newsletter:
+Your newsletter will be coming from this address:
+{information at encompassUS.org}
+Add this to your list of addresses from which you want to receive mail.
+
+Encompass Headquarters
+401 N. Michigan Avenue
+Suite 2200
+Chicago, IL 60611
+Tel: 877.354.9887
+
+
Added: packages/libemail-simple-perl/branches/upstream/current/t/unit.t
===================================================================
--- packages/libemail-simple-perl/branches/upstream/current/t/unit.t 2006-03-16 13:14:27 UTC (rev 2382)
+++ packages/libemail-simple-perl/branches/upstream/current/t/unit.t 2006-03-17 11:27:20 UTC (rev 2383)
@@ -0,0 +1,53 @@
+#!/usr/bin/perl
+# This is a series of unit tests to ensure that things do what I think
+# they do.
+use strict;
+use Email::Simple;
+
+package Email::Simple;
+use Test::More tests => 15;
+
+# Simple "email", no body
+
+my $text = "a\nb\nc\n";
+my ($h, $b) = _split_head_from_body($text);
+is($h, $text, "No body, everything's head");
+is($b, "", "No body!");
+
+# Simple "email", properly formed
+
+$text = "a\n\nb\n";
+($h, $b) = _split_head_from_body($text);
+is($h, "a\n", "Simple mail, head OK");
+is($b, "b\n", "Simple mail, body OK");
+
+# Simple "email" with blank lines
+
+$text = "a\n\nb\nc\n";
+($h, $b) = _split_head_from_body($text);
+is($h, "a\n", "Simple mail, head OK");
+is($b, "b\nc\n", "Simple mail, body OK");
+
+# Blank line as first line in email
+$text = "a\n\n\nb\nc\n";
+($h, $b) = _split_head_from_body($text);
+is($h, "a\n", "Simple mail, head OK");
+is($b, "\nb\nc\n", "Simple mail, body OK");
+
+# Testing the header parsing code
+
+my $head = "From: foo\n";
+my ($hh, $ord) = _read_headers($head);
+is($hh->{From}->[0], "foo", "Simplest header works");
+is_deeply($ord, ["From"], "Order is correct" );
+
+$head = "From: foo\nBar: baz\n";
+($hh, $ord) = _read_headers($head);
+is($hh->{From}->[0], "foo", "Header 2.1");
+is($hh->{Bar}->[0], "baz", "Header 2.2");
+is_deeply($ord, ["From", "Bar"], "Order is correct" );
+# Folding!
+$head = "From: foo\n baz\n";
+($hh, $ord) = _read_headers($head);
+is($hh->{From}->[0], "foo baz", "Header 3.1");
+is_deeply($ord, ["From"], "Order is correct" );
More information about the Pkg-perl-cvs-commits
mailing list