27 Mar 2007 17:41:29 UTC
- Distribution: Email-AddressParser
- Module version: 0.04
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (2)
- Testers (2812 / 2 / 15)
- KwaliteeBus factor: 0
- 89.29% Coverage
- License: unknown
- Activity24 month
- Download (38.67KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
Email::AddressParser - RFC 2822 Address Parsing and Creation
use Email::AddressParser; my @addresses = Email::AddressParser->parse($line); my $address = Email::AddressParser->new(Tony => 'tony@localhost'); print $address->format;
This class is a near drop-in replacement for the regex parsing of Email::Address, which has serious issues for production use (exponential to infinite computation time in some cases). It uses code from Mark Crispin's c-client library to implement the parsing. The resulting parser is much more stable than the regex-based version of Email::Address.
Note, RFC2822 comments are removed by this version (you can pass them in, and you can ask for them, but they will always be empty).
my @addrs = Email::Address->parse( q[me@local, Tony <me@local>, "Tony" <me@local>] );
This method returns a list of
Email::Addressobjects it finds in the input string.
There are no comment nesting limitations on this method, though all comments will be ignored.
my $address = Email::Address->new(undef, 'tony@local'); my $address = Email::Address->new('tony kay', 'tony@local'); my $address = Email::Address->new(undef, 'tony@local', '(tony)');
Constructs and returns a new
Email::AddressParserobject. Takes four positional arguments: phrase, email, and comment.
my $phrase = $address->phrase; $address->phrase( "Me oh my" );
Accessor for the phrase portion of an address.
- address my $addr = $address->address; $addr->address( "me@PROTECTED.com" );
Accessor for the address portion of an address.
my $comment = $address->comment; $address->comment( "(Work address)" );
Accessor for the comment portion of an address. Currently a no-op.
my $printable = $address->format;
Returns a properly formatted RFC 2822 address representing the object.
Parser by Mark Crispin. Perl integration by Anthony Kay <firstname.lastname@example.org>. Most documentation shamelessly borrowed from Email::Address.
All parsing code is Copyright (c) 1988-2006 University of Washington, under the Apache License 2.0. The Perl integration is licesened under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 153:
You forgot a '=back' before '=head2'
Module Install Instructions
To install Email::AddressParser, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Email::AddressParser
For more information on module installation, please visit the detailed CPAN module installation guide.