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: 13887
Status: resolved
Priority: 0/
Queue: Email-Address

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

Bug Information
Severity: Normal
Broken in: 1.80
Fixed in: (no value)



Subject: Quoting the Phrase
Download (untitled) / with headers
text/plain 1.5k
Hi Casey. It would be good if this module automatically quoted the phrase part of an e-mail address if necessary, that is putting it in quote marks if it doesn't consist only of certain characters. I have a DB with names in one field and e-mail address in another. I'd like to combine them (for sending them mail), but using Email::Address can currently yield invalid e-mail addresses. For example this is fine: % perl -MEmail::Address -wle 'print Email::Address->new(q[Homer J Simpson], q[homer@example.org])->format' Homer J Simpson <homer@example.org> But put a dot in there and it's broken: % perl -MEmail::Address -wle 'print Email::Address->new(q[Homer J. Simpson], q[homer@example.org])->format' Homer J. Simpson <homer@example.org> Mail::Address does this correctly -- just swapping the module name in the above 2 examples gives: % perl -MMail::Address -wle 'print Mail::Address->new(q[Homer J Simpson], q[homer@example.org])->format' Homer J Simpson <homer@example.org> and: % perl -MMail::Address -wle 'print Mail::Address->new(q[Homer J. Simpson], q[homer@example.org])->format' "Homer J. Simpson" <homer@example.org> I've had a quick look at the quoting code in Mail::Address, and it looks like you could steal it. I haven't worked out whether it'd be better to do the quoting on input or output. I only need it for manually created addresses, not those being parsed from somewhere; if you do this for the latter too then you'll have to make sure you allow for any quotes that are already in there, to avoid risking quoting stuff twice ("\"Homer J. Simpson\"" -- yuck!). Best wishes. Smylers
Download (untitled) / with headers
text/plain 150b
1.884 is greatly improved, enquoting very aggressively. It is not perfect, but it is less insane. I will make it even saner in the future. -- rjbs
I believe 1.885 is Good Enough to close this ticket. -- rjbs


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.