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

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

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



Subject: DWIM when parsing in scalar context
This should DWIM, but it doesn't: my $address = Email::Address->parse( $from_header ); Instead, $address contains the number of addresses found since parse() returns an array. It would be nice if parse() would DWIM and check wantarray and return the first address if called in scalar context or the full list if called in list context. Alternatively, at please document this behavior as a "gotcha" in the POD for parse(). -- David
Subject: Re: [rt.cpan.org #39299] DWIM when parsing in scalar context
Date: Mon, 15 Sep 2008 13:28:58 -0400
To: David Golden via RT <bug-Email-Address [...] rt.cpan.org>
From: Ricardo SIGNES <rjbs [...] cpan.org>
* David Golden via RT <bug-Email-Address@rt.cpan.org> [2008-09-15T13:24:05] Show quoted text
> It would be nice if parse() would DWIM and check wantarray and return > the first address if called in scalar context or the full list if called > in list context. > > Alternatively, at please document this behavior as a "gotcha" in the POD > for parse().
I am leaning toward documenting it as a gotcha, as I worry that people will use parse without realizing that there could be more than one return value. Of course, maybe I shouldn't give a damn about that. Maybe I'll document the exception and make calling it in $ fatal. -- rjbs
documentation updated in git -- rjbs