> On 25 Nov 2003, at 12:36, Brian Grossman wrote:
> 
> > Ugh.  It looks like the way Mail::Address::format() uses it, 
> > new('','') is
> > most correct.  New('<>') is definitely incorrect, though new('') will 
> > work.
> 
> Can you please come up with a test that shows that new('<>') is 
> incorrect? I'm not going to just blindly apply this patch without a 
> test to show exactly what you're trying to achieve (that's not to say 
> that Ask won't apply the patch of course).
> 
> I have code that checks for the <> envelope sender, and it works fine, 
> so I'm wondering who's misunderstanding what here.

Are you checking format() or address()?

In the general case:

% perl -IMailTools-1.59 -MMail::Address -le 'print 
Mail::Address->new("phrase","<[EMAIL PROTECTED]>","comment")->format'
phrase <<address.com>> (comment)
% perl -IMailTools-1.59 -MMail::Address -le 'print Mail::Address->new("phrase","[EMAIL 
PROTECTED]","comment")->format'
phrase <address.com> (comment)

However, <> is special so:

% perl -IMailTools-1.59 -MMail::Address -wle 'print Mail::Address->new("<>")->format'
<>
% perl -IMailTools-1.59 -MMail::Address -wle 'print Mail::Address->new("<>")->address'
Use of uninitialized value in print at -e line 1.

% perl -IMailTools-1.59 -MMail::Address -wle 'print 
Mail::Address->new("<>","")->address'

% perl -IMailTools-1.59 -MMail::Address -wle 'print 
Mail::Address->new("<>","")->format'
<>
% perl -IMailTools-1.59 -MMail::Address -wle 'print Mail::Address->new("","")->address'

% perl -IMailTools-1.59 -MMail::Address -wle 'print Mail::Address->new("","")->format'

% perl -IMailTools-1.59 -MMail::Address -wle 'print 
Mail::Address->new("\"<>\"","")->address'

% perl -IMailTools-1.59 -MMail::Address -wle 'print 
Mail::Address->new("\"<>\"","")->format'
"<>"

So, with the stock version of MailTools-1.59, new('<>','') gives the best
results, though it's a kludge.  It's a kludge because angle brackets aren't
allowed in the phrase part.

Note that perldoc Mail::Address lists the second argument as required,
though the module is forgiving.

The debian patch that exposed this issue formats new('<>') as '"<>"' because
angle brackets aren't allowed in the phrase.  The debian bug db is back
up, so see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=104572 for the
debian patch.

Assuming the debian patch is correct, new('','') gives the least
bad results.

Brian

Reply via email to