Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Email-Address CPAN distribution.

Report information
The Basics
Id: 61011
Status: resolved
Priority: 0/
Queue: Email-Address

People
Owner: Nobody in particular
Requestors: MARKLE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.891
Fixed in: (no value)



Subject: mailbox pattern validates 'foo' as rfc822
Data::Validate::Email cannot build because of this bug. (I experience the same problem as the two automated test failures of that package, after recently upgrading all my CPAN libs.) Here's a test script that provides a framework for testing the regular expressions in Email::Address, with the patterns lifted from one of the test scripts in Data::Validate::Email. Or, if 'foo' is actually rfc822 compliant, and this is the 'domainless addresses' mentioned in the Changes file, please let me know and I'll refile against Data::Validate::Email. Thanks! --mark--
Subject: patterns.t
use Test::More; use strict; use warnings FATAL => 'all'; =for comment $Email::Address::addr_spec This regular expression defined what an email address is allowed to look like. $Email::Address::angle_addr This regular expression defines an $addr_spec wrapped in angle brackets. $Email::Address::name_addr This regular expression defines what an email address can look like with an optional preceeding display name, also known as the "phrase". $Email::Address::mailbox This is the complete regular expression defining an RFC 2822 emial address with an optional preceeding display name and optional following comment. =cut # tests (string, truth value) my %tests = ( mailbox => [ [qw( foo 0 )], [qw( foo@bar.com 1 )], [qw( bob@test.com.au 1 )], [qw( foo.bob@test.com.au 1 )], [qw( foo-bob@test-com.au 1 )], [qw( foo-bob@test.uk 1 )], [ 'Richard Sonnen <sonnen@frii.com>', 1 ], [ '<sonnen@frii.com>', 1 ], [ '"Richard Sonnen" <sonnen@frii.com>', 1 ], [ '"Richard Sonnen" <sonnen@frii.com> (comments)', 1 ], [ '', 0 ], [ 'foo', 0 ], [ 'foo bar@bar.com', 0 ], [ '<foo bar>@bar.com', 0 ], ], ); my $num_tests = scalar( map @{$_}, values %tests ); plan tests => $num_tests + 1; use_ok 'Email::Address'; my %pats = map { my $pat; eval '$pat = $Email::Address::'.$_; ($_ => $pat); } qw( addr_spec angle_addr name_addr mailbox ); for my $pattern_name (keys %tests) { for my $test (@{ $tests{$pattern_name} }) { my ($string, $expect_bool) = @{$test}; my $result = $string =~ /^$pats{$pattern_name}$/; ok( $expect_bool ? $result : !$result , "pat $pattern_name: $string" ); } }
test added to dist behavior reverted to that of 1.889 -- rjbs
On Fri Sep 03 22:07:41 2010, RJBS wrote: Show quoted text
> test added to dist > > behavior reverted to that of 1.889
Thanks. Which is actually "correct"? Other RFC822 libs do not allow a "domainless" mailbox, but I seem to recall hearing it is okay. After all, you can use `mail` to send to a local system user without a domain, and that is allowed - sendmail will accept it and attempt delivery. Mark
"foo" is not a valid 822 mailbox, but it's a valid 821 destination (RCPT). Email::Address is a big problem, because it is very unclear about what it expects to parse. Is it a mailbox comma list? Just "address soup"? 821 mailboxes? 822? I hope to fix this in the next few months by adding multiple parse methods with well-specified expectations. -- rjbs