#!/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 <--
--
Charles DeRykus
> 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
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\
> 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 <1u...@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/