Subject: | Several parsing and formatting bugs |
See the attached test script. I get the following output:
parsing: "Newsletter from <superm@rket>" <newsletter@example.com>
phrase: Newsletter from
address: superm@rket
reformatted: "Newsletter from " <superm@rket>
parsing: "Lawrence Peter \"Yogi\" Berra" <yogi@berra.com>
phrase: Lawrence Peter \"Yogi\" Berra
address: yogi@berra.com
reformatted: "Lawrence Peter \\"Yogi\\" Berra" <yogi@berra.com>
parsing: "Peter\\Sales Department" <peter@example.com>
phrase: Peter\\Sales Department
address: peter@example.com
reformatted: "Peter\\Sales Department" <peter@example.com>
parsing: "Peter\Sales Department" <peter@example.com>
phrase: Peter\Sales Department
address: peter@example.com
reformatted: "Peter\Sales Department" <peter@example.com>
Subject: | email_address_test.pl |
#!/usr/bin/perl
use strict;
use Email::Address;
sub test {
my $string = shift;
print "parsing: $string\n";
my @addresses = Email::Address->parse($string);
print "phrase: ", $addresses[0]->phrase, "\n";
print "address: ", $addresses[0]->address, "\n";
print "reformatted: ", $addresses[0]->format, "\n\n";
}
test('"Newsletter from <superm@rket>" <newsletter@example.com>');
test('"Lawrence Peter \\"Yogi\\" Berra" <yogi@berra.com>');
test('"Peter\\\\Sales Department" <peter@example.com>');
test('"Peter\\Sales Department" <peter@example.com>');