Google Groups Home
Help | Sign in
Simple problem with Email::Address
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Bernie Cosell  
View profile
 More options May 16, 1:37 pm
Newsgroups: comp.lang.perl.misc, comp.lang.perl.modules
From: Bernie Cosell <ber...@fantasyfarm.com>
Date: Fri, 16 May 2008 13:37:08 -0400
Local: Fri, May 16 2008 1:37 pm
Subject: Simple problem with Email::Address
I'm trying to parse an email address and I can't seem to get Email::Address
to work quite.

#!/usr/bin/perl

use strict;
use warnings ;
use Email::Address ;

my $addr = "My Name              <myname\@verizon.net>\n" ;
my @addrs = Email::Address::parse($addr) ;
warn scalar(@addrs) ;

Gets me "0" -- it appears not to parse that string, which certainly looks
like a legal email addr to me [am I missing some problem with it?? -- I
actually pulled it out of a file of addresses that sendmail is happily
sending-via].  What am I missing here?  THANKS!

  /bernie\
--
Bernie Cosell                     Fantasy Farm Fibers
ber...@fantasyfarm.com            Pearisburg, VA
    -->  Too many people, too few sheep  <--          


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
comp.llang.perl.moderated  
View profile
 More options May 16, 3:08 pm
Newsgroups: comp.lang.perl.misc, comp.lang.perl.modules
From: "comp.llang.perl.moderated" <c...@blv-sam-01.ca.boeing.com>
Date: Fri, 16 May 2008 12:08:51 -0700 (PDT)
Local: Fri, May 16 2008 3:08 pm
Subject: Re: Simple problem with Email::Address
On May 16, 10:37 am, Bernie Cosell <ber...@fantasyfarm.com> wrote:
> I'm trying to parse an email address and I can't seem to get Email::Address
> to work quite.

> #!/usr/bin/perl

> use strict;
> use warnings ;
> use Email::Address ;

> my $addr = "My Name              <myname\@verizon.net>\n" ;
> my @addrs = Email::Address::parse($addr) ;

              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
              Email::Address->parse($addr);

--
Charles DeRykus


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jim Gibson  
View profile
 More options May 16, 3:09 pm
Newsgroups: comp.lang.perl.misc, comp.lang.perl.modules
From: Jim Gibson <jimsgib...@gmail.com>
Date: Fri, 16 May 2008 12:09:25 -0700
Local: Fri, May 16 2008 3:09 pm
Subject: Re: Simple problem with Email::Address
In article <aahr24dpblvs36fuh7ja9gvdhavod3k...@library.airnews.net>,

Bernie Cosell <ber...@fantasyfarm.com> wrote:
> I'm trying to parse an email address and I can't seem to get Email::Address
> to work quite.

You are not calling parse() correctly.

> #!/usr/bin/perl

> use strict;
> use warnings ;
> use Email::Address ;

> my $addr = "My Name              <myname\@verizon.net>\n" ;
> my @addrs = Email::Address::parse($addr) ;

my @addrs = Email::Address->parse($addr);

> warn scalar(@addrs) ;

> Gets me "0" -- it appears not to parse that string, which certainly looks
> like a legal email addr to me [am I missing some problem with it?? -- I
> actually pulled it out of a file of addresses that sendmail is happily
> sending-via].  What am I missing here?  THANKS!

perldoc Email::Address

--
Jim Gibson

 Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
                http://www.usenet.com


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ber...@fantasyfarm.com  
View profile
 More options May 16, 3:17 pm
Newsgroups: comp.lang.perl.misc, comp.lang.perl.modules
From: ber...@fantasyfarm.com
Date: Fri, 16 May 2008 12:17:25 -0700 (PDT)
Local: Fri, May 16 2008 3:17 pm
Subject: Re: Simple problem with Email::Address
On May 16, 3:08 pm, "comp.llang.perl.moderated" <c...@blv-

sam-01.ca.boeing.com> wrote:
> On May 16, 10:37 am, Bernie Cosell <ber...@fantasyfarm.com> wrote:> I'm trying to parse an email address and I can't seem to get Email::Address
> > to work quite.

> > #!/usr/bin/perl

> > use strict;
> > use warnings ;
> > use Email::Address ;

> > my $addr = "My Name              <myname\@verizon.net>\n" ;
> > my @addrs = Email::Address::parse($addr) ;

>               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>               Email::Address->parse($addr);

Thanks!  Total brain cramp...  I _thought_ I had cut/pasted the call
to parse from the E::A man page but obviously I screwed up bigtime
[and it was one of those dumbnesses that after-the-fact you can't see
in your own code].  THANKS!!

  /Bernie\


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
A. Sinan Unur  
View profile
 More options May 16, 3:21 pm
Newsgroups: comp.lang.perl.misc, comp.lang.perl.modules
From: "A. Sinan Unur" <1...@llenroc.ude.invalid>
Date: Fri, 16 May 2008 19:21:51 GMT
Local: Fri, May 16 2008 3:21 pm
Subject: Re: Simple problem with Email::Address
Bernie Cosell <ber...@fantasyfarm.com> wrote in
news:aahr24dpblvs36fuh7ja9gvdhavod3kn9o@library.airnews.net:

> I'm trying to parse an email address and I can't seem to get
> Email::Address to work quite.

> #!/usr/bin/perl

> use strict;
> use warnings ;
> use Email::Address ;

> my $addr = "My Name              <myname\@verizon.net>\n" ;
> my @addrs = Email::Address::parse($addr) ;

parse is a class method.

C:\Temp> cat x.pl
#!/usr/bin/perl

use strict;
use warnings;

use Data::Dumper;
use Email::Address;

my $in = "My Name              <myname\@verizon.net>";
print Dumper ( Email::Address->parse($in) )

__END__

C:\Temp> x
$VAR1 = bless( [
                 'My Name',
                 'myn...@verizon.net',
                 '',
                 'My Name <myn...@verizon.net>',
                 [
                   \'My Name <myn...@verizon.net>',
                   '0'
                 ]
               ], 'Email::Address' );

Sinan

--
A. Sinan Unur <1...@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google