about summary refs log tree commit homepage
path: root/lib/PublicInbox/Address.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-12-10 13:42:52 +0000
committerEric Wong <e@80x24.org>2023-12-10 21:48:34 +0000
commit235b55840c4066029e56ed91d6d3dc46c921a23b (patch)
treec3df23e25de3c4e9644fadef2b31ca32fd700d91 /lib/PublicInbox/Address.pm
parent8188164496fcd36aa4fc6ac14a5e4782feace077 (diff)
downloadpublic-inbox-235b55840c4066029e56ed91d6d3dc46c921a23b.tar.gz
Our pure-Perl (PublicInbox::AddressPP) fallback is closer to the
preferred Email::Address::XS (EAX) behavior than Mail::Address
is for ->name support.  EAX tends to be overkill with good spam
filtering, and using our own fallback means life is easier for
users with neither C/XS build tools nor a pre-built EAX package.
Diffstat (limited to 'lib/PublicInbox/Address.pm')
-rw-r--r--lib/PublicInbox/Address.pm9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/PublicInbox/Address.pm b/lib/PublicInbox/Address.pm
index 2c9c4395..a5902cfd 100644
--- a/lib/PublicInbox/Address.pm
+++ b/lib/PublicInbox/Address.pm
@@ -1,9 +1,8 @@
-# Copyright (C) 2016-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 package PublicInbox::Address;
-use strict;
-use v5.10.1;
-use parent 'Exporter';
+use v5.12;
+use parent qw(Exporter);
 our @EXPORT_OK = qw(pairs);
 
 sub xs_emails {
@@ -31,6 +30,7 @@ eval {
         *emails = \&xs_emails;
         *names = \&xs_names;
         *pairs = \&xs_pairs;
+        *objects = sub { Email::Address::XS->parse(@_) };
 };
 
 if ($@) {
@@ -38,6 +38,7 @@ if ($@) {
         *emails = \&PublicInbox::AddressPP::emails;
         *names = \&PublicInbox::AddressPP::names;
         *pairs = \&PublicInbox::AddressPP::pairs;
+        *objects = \&PublicInbox::AddressPP::objects;
 }
 
 1;