On 2/5/07, Chad Eldridge <[EMAIL PROTECTED]> wrote:
[snip]
> But using Email::Address would have got it right in the first place, and
> I still
> can't see what the disadvantage is.
>
> HTH,
>
> Rob
You are right about that code I posted, I'm sorry about that. I was
thrown together in a hurry while doing several things at once. I guess I
should take more time when trying to help someone.
As to disadvantages to Email::Address, I can't see any. It's not a
matter of disadvantage, I just prefer to write the code myself when I
can. Mostly this comes just from curiousity. So, it's really more
preference than a matter of advantage. I'm not going to try and re-write
Net::SMTP or anything.
Chad
As a personal choice, that's fine: TMTOWTDI. It's also fine to suggest
a solution that answers the original question even after a suitable
module has been suggested. Showing someone how to accomplish the task
manually can certainly serve a pedagogical purpose. Please, though,
don't suggest that people not use modules to accomplish tasks. CPAN is
there to make life easier for everyone, beginners especially. If a
CPAN module exists, it is because the task it accomplishes is
sufficiently common, tedious, or difficult that it made sense for
people to stop reinventing the wheel every time they wanted to perform
it.
Parsing Email addresses is a perfect example: rfc2822 is long and
detailed, and not everyone who would like to work with emails
addresses wants to read it. It is also sufficiently complex that it
has proved impossible to accommodate it with a single regex, much less
an efficient one.
Also, the Perl community's current consensus on best practices almost
universally stresses using modules where available because they
contribute uniformity, and therefore maintainability, of code. From a
practical standpoint, too, well-maintained modules like Email::Address
that have had many, many sets of eyes looking at them over the years
are far more likely to accomplish complex tasks successfully than an
off-the-cuff response to this mailing list.
And all of this is doubly true of parsing Email addresses, which is a
task so common that it warrants its own FAQ (it's in perlfaq9, if you
haven't seen it) and so complex that the answer to the FAQ is,
essentially, "see CPAN."
Best,
-- jay
--------------------------------------------------
This email and attachment(s): [ ] blogable; [ x ] ask first; [ ]
private and confidential
daggerquill [at] gmail [dot] com
http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org
values of β will give rise to dom!