r1701 - in packages: . libemail-filter-perl libemail-filter-perl/branches libemail-filter-perl/branches/upstream libemail-filter-perl/branches/upstream/current libemail-filter-perl/branches/upstream/current/lib libemail-filter-perl/branches/upstream/current/lib/Email libemail-filter-perl/branches/upstream/current/t

Niko Tyni ntyni-guest at costa.debian.org
Mon Dec 19 22:43:13 UTC 2005


Author: ntyni-guest
Date: 2005-12-19 22:43:12 +0000 (Mon, 19 Dec 2005)
New Revision: 1701

Added:
   packages/libemail-filter-perl/
   packages/libemail-filter-perl/branches/
   packages/libemail-filter-perl/branches/upstream/
   packages/libemail-filter-perl/branches/upstream/current/
   packages/libemail-filter-perl/branches/upstream/current/CHANGES
   packages/libemail-filter-perl/branches/upstream/current/MANIFEST
   packages/libemail-filter-perl/branches/upstream/current/MANIFEST.SKIP
   packages/libemail-filter-perl/branches/upstream/current/META.yml
   packages/libemail-filter-perl/branches/upstream/current/Makefile.PL
   packages/libemail-filter-perl/branches/upstream/current/README
   packages/libemail-filter-perl/branches/upstream/current/lib/
   packages/libemail-filter-perl/branches/upstream/current/lib/Email/
   packages/libemail-filter-perl/branches/upstream/current/lib/Email/Filter.pm
   packages/libemail-filter-perl/branches/upstream/current/t/
   packages/libemail-filter-perl/branches/upstream/current/t/Email-Filter.t
   packages/libemail-filter-perl/branches/upstream/current/t/josey-nofold
   packages/libemail-filter-perl/tags/
Log:
[svn-inject] Installing original source of libemail-filter-perl

Added: packages/libemail-filter-perl/branches/upstream/current/CHANGES
===================================================================
--- packages/libemail-filter-perl/branches/upstream/current/CHANGES	2005-12-19 22:41:24 UTC (rev 1700)
+++ packages/libemail-filter-perl/branches/upstream/current/CHANGES	2005-12-19 22:43:12 UTC (rev 1701)
@@ -0,0 +1,20 @@
+Changes file for Email::Filter
+
+1.02    2004-11-06
+
+  - pipe() is now safe against IPC::Run::run() death, in the
+    event of improper input.
+  - Docs for pipe() now express proper input.
+  - Dependency updates.
+  - Doc fixes.
+  - Author update.
+
+1.01	Tuesday 29th June, 2004
+	discard any From_ line before we hand it to Email::Simple
+	pod fixes
+
+1.0	2nd May, 2003
+	Initial CPAN release
+
+0.000_1 Sun Mar 16 14:18:44 2003
+    - Created

Added: packages/libemail-filter-perl/branches/upstream/current/MANIFEST
===================================================================
--- packages/libemail-filter-perl/branches/upstream/current/MANIFEST	2005-12-19 22:41:24 UTC (rev 1700)
+++ packages/libemail-filter-perl/branches/upstream/current/MANIFEST	2005-12-19 22:43:12 UTC (rev 1701)
@@ -0,0 +1,9 @@
+CHANGES
+lib/Email/Filter.pm
+Makefile.PL
+MANIFEST			This list of files
+MANIFEST.SKIP
+META.yml
+README
+t/Email-Filter.t
+t/josey-nofold

Added: packages/libemail-filter-perl/branches/upstream/current/MANIFEST.SKIP
===================================================================
--- packages/libemail-filter-perl/branches/upstream/current/MANIFEST.SKIP	2005-12-19 22:41:24 UTC (rev 1700)
+++ packages/libemail-filter-perl/branches/upstream/current/MANIFEST.SKIP	2005-12-19 22:43:12 UTC (rev 1701)
@@ -0,0 +1,13 @@
+CVS/.*
+^\.
+\.bak$
+\.sw[a-z]$
+\.tar$
+\.tgz$
+\.tar\.gz$
+^tmp/
+^blib/
+^Makefile$
+^Makefile\.[a-z]+$
+^pm_to_blib$
+~$

Added: packages/libemail-filter-perl/branches/upstream/current/META.yml
===================================================================
--- packages/libemail-filter-perl/branches/upstream/current/META.yml	2005-12-19 22:41:24 UTC (rev 1700)
+++ packages/libemail-filter-perl/branches/upstream/current/META.yml	2005-12-19 22:43:12 UTC (rev 1701)
@@ -0,0 +1,15 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
+name:         Email-Filter
+version:      1.02
+version_from: lib/Email/Filter.pm
+installdirs:  site
+requires:
+    Class::Trigger:                0.08
+    Email::LocalDelivery:          0.07
+    Email::Simple:                 1.91
+    IPC::Run:                      0.77
+    Test::More:                    0.47
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17

Added: packages/libemail-filter-perl/branches/upstream/current/Makefile.PL
===================================================================
--- packages/libemail-filter-perl/branches/upstream/current/Makefile.PL	2005-12-19 22:41:24 UTC (rev 1700)
+++ packages/libemail-filter-perl/branches/upstream/current/Makefile.PL	2005-12-19 22:43:12 UTC (rev 1701)
@@ -0,0 +1,14 @@
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+    NAME          => 'Email::Filter',
+    VERSION_FROM  => 'lib/Email/Filter.pm',
+    EXE_FILES     => [],
+               PREREQ_PM     => {
+                                 'Class::Trigger' => '0.08',
+                                 'Email::LocalDelivery' => '0.07',
+                                 'Email::Simple' => '1.91',
+                                 'IPC::Run' => '0.77',
+                                 'Test::More' => '0.47',
+                                },
+);

Added: packages/libemail-filter-perl/branches/upstream/current/README
===================================================================
--- packages/libemail-filter-perl/branches/upstream/current/README	2005-12-19 22:41:24 UTC (rev 1700)
+++ packages/libemail-filter-perl/branches/upstream/current/README	2005-12-19 22:43:12 UTC (rev 1701)
@@ -0,0 +1,174 @@
+NAME
+    Email::Filter - Library for creating easy email filters
+
+SYNOPSIS
+        use Email::Filter;
+        my $mail = Email::Filter->new(emergency => "~/emergency_mbox");
+        $mail->pipe("listgate", "p5p")         if $mail->from =~ /perl5-porters/;
+        $mail->accept("perl")                  if $mail->from =~ /perl/;
+        $mail->reject("We do not accept spam") if $mail->subject =~ /enlarge/;
+        $mail->ignore                          if $mail->subject =~ /boring/i;
+        ...
+        $mail->exit(0);
+        $mail->accept("~/Mail/Archive/backup");
+        $mail->exit(1);
+        $mail->accept()
+
+DESCRIPTION
+    This is another module produced by the "Perl Email Project", a reaction
+    against the complexity and increasing bugginess of the "Mail::*"
+    modules. It replaces "Mail::Audit", and allows you to write programs
+    describing how your mail should be filtered.
+
+TRIGGERS
+    Users of "Mail::Audit" will note that this class is much leaner than the
+    one it replaces. For instance, it has no logging; the concept of "local
+    options" has gone away, and so on. This is a deliberate design decision
+    to make the class as simple and maintainable as possible.
+
+    To make up for this, however, "Email::Filter" contains a trigger
+    mechanism provided by Class::Trigger, to allow you to add your own
+    functionality. You do this by calling the "add_trigger" method:
+
+        Email::Audit->add_trigger( after_accept => \&log_accept );
+
+    Hopefully this will also help subclassers.
+
+    The methods below will list which triggers they provide.
+
+ERROR RECOVERY
+    If something bad happens during the "accept" or "pipe" method, or the
+    "Email::Filter" object gets destroyed without being properly handled,
+    then a fail-safe error recovery process is called. This first checks for
+    the existence of the "emergency" setting, and tries to deliver to that
+    mailbox. If there is no emergency mailbox or that delivery failed, then
+    the program will either exit with a temporary failure error code,
+    queuing the mail for redelivery later, or produce a warning to standard
+    error, depending on the status of the "exit" setting.
+
+METHODS
+  new
+        Email::Filter->new();                # Read from STDIN
+        Email::Filter->new(data => $string); # Read from string
+
+        Email::Filter->new(emergency => "~simon/urgh");
+        # Deliver here in case of error
+
+    This takes an email either from standard input, the usual case when
+    called as a mail filter, or from a string.
+
+    You may also provide an "emergency" option, which is a filename to
+    deliver the mail to if it couldn't, for some reason, be handled
+    properly.
+
+    Hint
+       If you put your constructor in a "BEGIN" block, like so:
+
+           use Email::Filter;
+           BEGIN { $item = Email::Filter->new(emergency => "~simon/urgh"); }
+
+       right at the top of your mail filter script, you'll even be protected
+       from losing mail even in the case of syntax errors in your script.
+       How neat is that?
+
+    This method provides the "new" trigger, called once an object is
+    instantiated.
+
+  exit
+        $mail->exit(1|0);
+
+    Sets or clears the 'exit' flag which determines whether or not the
+    following methods exit after successful completion.
+
+    The sense-inverted 'noexit' method is also provided for backwards
+    compatibility with "Mail::Audit", but setting "noexit" to "yes" got a
+    bit mind-bending after a while.
+
+  simple
+        $mail->simple();
+
+    Gets and sets the underlying "Email::Simple" object for this filter; see
+    Email::Simple for more details.
+
+  header
+        $mail->header("X-Something")
+
+    Returns the specified mail headers. In scalar context, returns the first
+    such header; in list context, returns them all.
+
+  body
+        $mail->body()
+
+    Returns the body text of the email
+
+  from
+  to
+  cc
+  bcc
+  subject
+  received
+        $mail-><header>()
+
+    Convenience accessors for "header($header)"
+
+  ignore
+    Ignores this mail, exiting unconditionally unless "exit" has been set to
+    false.
+
+    This method provides the "ignore" trigger.
+
+  accept
+        $mail->accept();
+        $mail->accept(@where);
+
+    Accepts the mail into a given mailbox or mailboxes. Unix "~/" and
+    "~user/" prefices are resolved. If no mailbox is given, the default is
+    determined according to Email::LocalDelivery: $ENV{MAIL},
+    /var/spool/mail/you, /var/mail/you, or ~you/Maildir/.
+
+    This provides the "before_accept" and "after_accept" triggers, and exits
+    unless "exit" has been set to false.
+
+  reject
+        $mail->reject("Go away!");
+
+    This rejects the email; if called in a pipe from a mail transport agent,
+    (such as in a ~/.forward file) the mail will be bounced back to the
+    sender as undeliverable. If a reason is given, this will be included in
+    the bounce.
+
+    This calls the "reject" trigger. "exit" has no effect here.
+
+  pipe
+        $mail->pipe('sendmail foo at bar.com');
+
+    Pipes the mail to an external program, returning the standard output
+    from that program if "exit" has been set to false. This allows you to do
+    things like
+
+        $mail->exit(0);
+        $mail->simple(Email::Simple->new($mail->pipe("spamassassin")));
+        $mail->exit(1);
+
+    in the absence of decent "Mail::SpamAssassin" support. (Coming soon...)
+
+    If the program returns a non-zero exit code, the behaviour is dependent
+    on the status of the "exit" flag. If this flag is set to true (the
+    default), then "Email::Filter" tries to recover. (See "ERROR RECOVERY")
+    If not, nothing is returned.
+
+COPYRIGHT
+        Copyright 2003, Simon Cozens <simon at cpan.org>
+
+LICENSE
+    You may use this module under the terms of the BSD, Artistic, or GPL
+    licenses, any version.
+
+AUTHOR
+    Casey West, "casey at geeknest.com"
+
+    Simon Cozens, "simon at cpan.org"
+
+SEE ALSO
+    http://pep,kwiki.org
+

Added: packages/libemail-filter-perl/branches/upstream/current/lib/Email/Filter.pm
===================================================================
--- packages/libemail-filter-perl/branches/upstream/current/lib/Email/Filter.pm	2005-12-19 22:41:24 UTC (rev 1700)
+++ packages/libemail-filter-perl/branches/upstream/current/lib/Email/Filter.pm	2005-12-19 22:43:12 UTC (rev 1701)
@@ -0,0 +1,354 @@
+package Email::Filter;
+# $Id: Filter.pm,v 1.7 2004/11/06 19:00:31 cwest Exp $
+use strict;
+
+use Email::LocalDelivery;
+use Email::Simple;
+use Class::Trigger;
+use IPC::Run qw(run);
+
+use constant DELIVERED => 0;
+use constant TEMPFAIL  => 75;
+use constant REJECTED  => 100;
+
+$Email::Filter::VERSION = "1.02";
+
+=head1 NAME
+
+Email::Filter - Library for creating easy email filters
+
+=head1 SYNOPSIS
+
+    use Email::Filter;
+    my $mail = Email::Filter->new(emergency => "~/emergency_mbox");
+    $mail->pipe("listgate", "p5p")         if $mail->from =~ /perl5-porters/;
+    $mail->accept("perl")                  if $mail->from =~ /perl/;
+    $mail->reject("We do not accept spam") if $mail->subject =~ /enlarge/;
+    $mail->ignore                          if $mail->subject =~ /boring/i;
+    ...
+    $mail->exit(0);
+    $mail->accept("~/Mail/Archive/backup");
+    $mail->exit(1);
+    $mail->accept()
+
+=head1 DESCRIPTION
+
+This is another module produced by the "Perl Email Project", a reaction
+against the complexity and increasing bugginess of the "Mail::*"
+modules. It replaces C<Mail::Audit>, and allows you to write programs
+describing how your mail should be filtered.
+
+=head1 TRIGGERS
+
+Users of C<Mail::Audit> will note that this class is much leaner than
+the one it replaces. For instance, it has no logging; the concept of
+"local options" has gone away, and so on. This is a deliberate design
+decision to make the class as simple and maintainable as possible.
+
+To make up for this, however, C<Email::Filter> contains a trigger
+mechanism provided by L<Class::Trigger>, to allow you to add your own
+functionality. You do this by calling the C<add_trigger> method:
+
+    Email::Audit->add_trigger( after_accept => \&log_accept );
+
+Hopefully this will also help subclassers.
+
+The methods below will list which triggers they provide.
+
+=head1 ERROR RECOVERY
+
+If something bad happens during the C<accept> or C<pipe> method, or
+the C<Email::Filter> object gets destroyed without being properly
+handled, then a fail-safe error recovery process is called. This first
+checks for the existence of the C<emergency> setting, and tries to
+deliver to that mailbox. If there is no emergency mailbox or that
+delivery failed, then the program will either exit with a temporary
+failure error code, queuing the mail for redelivery later, or produce a
+warning to standard error, depending on the status of the C<exit>
+setting.
+
+=cut
+
+sub done_ok {
+    my $self = shift;
+    $self->{delivered} = 1;
+    exit DELIVERED unless $self->{noexit};
+}
+
+sub fail_badly {
+    my $self = shift;
+    $self->{giveup} = 1; # Don't get caught by DESTROY
+    exit TEMPFAIL unless $self->{noexit};
+    warn "Message ".$self->simple->header("Message-ID").
+          "was never handled properly\n";
+}
+
+sub fail_gracefully {
+    my $self = shift;
+    if ($self->{emergency} and $self->accept($self->{emergency})) {
+        $self->done_ok; # That worked.
+    }
+    $self->fail_badly;
+}
+
+sub DESTROY {
+    my $self = shift;
+    return if $self->{delivered}   # All OK.
+           or $self->{giveup}      # Tried emergency, didn't work.
+           or !$self->{emergency}; # Not much we can do.
+    $self->fail_gracefully();
+}
+
+=head1 METHODS
+
+=head2 new
+
+    Email::Filter->new();                # Read from STDIN
+    Email::Filter->new(data => $string); # Read from string
+
+    Email::Filter->new(emergency => "~simon/urgh");
+    # Deliver here in case of error
+
+This takes an email either from standard input, the usual case when
+called as a mail filter, or from a string.
+
+You may also provide an "emergency" option, which is a filename to
+deliver the mail to if it couldn't, for some reason, be handled
+properly.
+
+=over 3
+
+=item Hint
+
+If you put your constructor in a C<BEGIN> block, like so:
+
+    use Email::Filter;
+    BEGIN { $item = Email::Filter->new(emergency => "~simon/urgh"); }
+
+right at the top of your mail filter script, you'll even be protected
+from losing mail even in the case of syntax errors in your script. How
+neat is that?
+
+=back
+
+This method provides the C<new> trigger, called once an object is
+instantiated.
+
+=cut
+
+sub new {
+    my $class = shift;
+    my %stuff = @_;
+    my $data;
+
+    {
+    local $/;
+    $data = exists $stuff{data} ? $stuff{data} : scalar <STDIN>;
+    # shave any leading From_ line
+    $data =~ s/^From .*?[\x0a\x0d]//
+    }
+
+    my $obj = bless {
+        mail       => Email::Simple->new($data),
+        emergency  => $stuff{emergency},
+        noexit     => ($stuff{noexit} || 0)
+    }, $class;
+    $obj->call_trigger("new");
+    return $obj;
+}
+
+=head2 exit
+
+    $mail->exit(1|0);
+
+Sets or clears the 'exit' flag which determines whether or not the
+following methods exit after successful completion.
+
+The sense-inverted 'noexit' method is also provided for backwards
+compatibility with C<Mail::Audit>, but setting "noexit" to "yes" got a
+bit mind-bending after a while.
+
+=cut
+
+sub exit { $_[0]->{noexit} = !$_[1]; }
+sub noexit { $_[0]->{noexit} = $_[1]; }
+
+=head2 simple
+
+    $mail->simple();
+
+Gets and sets the underlying C<Email::Simple> object for this filter;
+see L<Email::Simple> for more details.
+
+=cut
+
+sub simple {
+    my ($filter, $mail) = @_;
+    if ($mail) { $filter->{mail} = $mail; }
+    return $filter->{mail};
+}
+
+=head2 header
+
+    $mail->header("X-Something")
+
+Returns the specified mail headers. In scalar context, returns the
+first such header; in list context, returns them all.
+
+=cut
+
+sub header { my ($mail, $head) = @_; $mail->simple->header($head); }
+
+=head2 body
+
+    $mail->body()
+
+Returns the body text of the email
+
+=cut
+
+sub body { $_[0]->simple->body }
+
+=head2 from
+
+=head2 to
+
+=head2 cc
+
+=head2 bcc
+
+=head2 subject
+
+=head2 received
+
+    $mail-><header>()
+
+Convenience accessors for C<header($header)>
+
+=cut
+
+{ no strict 'refs';
+for my $head (qw(From To CC Bcc Subject Received)) {
+    *{lc $head} = sub { $_[0]->header($head) }
+}
+}
+
+=head2 ignore
+
+Ignores this mail, exiting unconditionally unless C<exit> has been set
+to false.
+
+This method provides the "ignore" trigger.
+
+=cut
+
+sub ignore {
+    $_[0]->call_trigger("ignore");
+    $_[0]->done_ok;
+}
+
+=head2 accept
+
+    $mail->accept();
+    $mail->accept(@where);
+
+Accepts the mail into a given mailbox or mailboxes.
+Unix C<~/> and C<~user/> prefices are resolved. If no mailbox is given,
+the default is determined according to L<Email::LocalDelivery>:
+C<$ENV{MAIL}>, F</var/spool/mail/you>, F</var/mail/you>, or
+F<~you/Maildir/>.
+
+This provides the C<before_accept> and C<after_accept> triggers, and
+exits unless C<exit> has been set to false.
+
+=cut
+
+sub accept {
+    my ($self, @boxes) = @_;
+    $self->call_trigger("before_accept");
+    # Unparsing and reparsing is so fast we prefer to do that in order
+    # to keep to LocalDelivery's clean interface.
+    if (Email::LocalDelivery->deliver($self->simple->as_string, @boxes)) {
+        $self->call_trigger("after_accept");
+        $self->done_ok;
+    } else {
+        $self->fail_gracefully();
+    }
+}
+
+=head2 reject
+
+    $mail->reject("Go away!");
+
+This rejects the email; if called in a pipe from a mail transport agent, (such
+as in a F<~/.forward> file) the mail will be bounced back to the sender as
+undeliverable. If a reason is given, this will be included in the bounce.
+
+This calls the C<reject> trigger. C<exit> has no effect here.
+
+=cut
+
+sub reject {
+    my $self = shift;
+    $self->call_trigger("reject");
+    $self->{delivered} = 1;
+    $! = REJECTED; die @_,"\n";
+}
+
+=head2 pipe
+
+    $mail->pipe(qw[sendmail foo\@bar.com]);
+
+Pipes the mail to an external program, returning the standard output
+from that program if C<exit> has been set to false. The program and each
+of its arguments must be supplied in a list. This allows you to do
+things like:
+
+    $mail->exit(0);
+    $mail->simple(Email::Simple->new($mail->pipe("spamassassin")));
+    $mail->exit(1);
+
+in the absence of decent C<Mail::SpamAssassin> support.
+
+If the program returns a non-zero exit code, the behaviour is dependent
+on the status of the C<exit> flag. If this flag is set to true (the
+default), then C<Email::Filter> tries to recover. (See L</ERROR RECOVERY>)
+If not, nothing is returned.
+
+=cut
+
+sub pipe {
+    my ($self, @program) = @_;
+    my $stdout;
+    my $string = $self->simple->as_string;
+    $self->call_trigger("pipe");
+    if (eval {run(\@program, \$string, \$stdout)} ) {
+        $self->done_ok;
+        return $stdout;
+    }
+    $self->fail_gracefully() unless $self->{noexit};
+    return;
+}
+
+=head1 COPYRIGHT
+
+    Copyright 2003, Simon Cozens <simon at cpan.org>
+
+=head1 LICENSE
+
+You may use this module under the terms of the BSD, Artistic, or GPL licenses,
+any version.
+
+=head1 AUTHOR
+
+Casey West, C<casey at geeknest.com>
+
+Simon Cozens, C<simon at cpan.org>
+
+=head1 SEE ALSO
+
+http://pep,kwiki.org
+
+=cut
+
+1;

Added: packages/libemail-filter-perl/branches/upstream/current/t/Email-Filter.t
===================================================================
--- packages/libemail-filter-perl/branches/upstream/current/t/Email-Filter.t	2005-12-19 22:41:24 UTC (rev 1700)
+++ packages/libemail-filter-perl/branches/upstream/current/t/Email-Filter.t	2005-12-19 22:43:12 UTC (rev 1701)
@@ -0,0 +1,28 @@
+use Test::More 'no_plan';
+use strict;
+$^W = 1;
+use File::Temp qw(tmpnam);
+use_ok("Email::Filter");
+
+open IN, "t/josey-nofold" or die $!;
+my $mail;
+{local $/; $mail = <IN>; }
+
+my $x = Email::Filter->new(data => $mail);
+isa_ok($x, "Email::Filter");
+is($x->{noexit}, 0, "exit flag set correctly");
+
+$x->exit(0);
+is($x->{noexit}, 1, "exit flag set correctly");
+
+my $where = tmpnam();
+ok(!-f $where, "Just testing... (Going to $where)");
+$x->accept($where);
+ok(-f $where, "Delivered OK");
+unlink $where;
+
+my $y = $x->pipe("$^X", "-pe1"); # A sort of portable /bin/cat
+is($y, $mail, "pipe works");
+
+my $z = $x->pipe("$^X -pe1");
+is $z, undef, 'pipe failed for broken input';

Added: packages/libemail-filter-perl/branches/upstream/current/t/josey-nofold
===================================================================
--- packages/libemail-filter-perl/branches/upstream/current/t/josey-nofold	2005-12-19 22:41:24 UTC (rev 1700)
+++ packages/libemail-filter-perl/branches/upstream/current/t/josey-nofold	2005-12-19 22:43:12 UTC (rev 1701)
@@ -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




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