Skip to content

Commit

Permalink
Fold in changes present in released 0.01, but not in repository
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmv committed Jan 22, 2014
1 parent 207afa5 commit 59a0e6c
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 7 deletions.
10 changes: 9 additions & 1 deletion META.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
---
abstract: 'RFC close address list parsing'
author:
- 'Ruslan Zakirov <ruz@bestpractical.com>'
build_requires:
ExtUtils::MakeMaker: 6.36
JSON: 0
Test::More: 0
configure_requires:
ExtUtils::MakeMaker: 6.36
distribution_type: module
dynamic_config: 1
generated_by: 'Module::Install version 1.06'
license: unknown
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
Expand All @@ -17,4 +21,8 @@ no_index:
directory:
- inc
- t
requires:
Email::Address: 0
resources:
license: http://dev.perl.org/licenses/
version: 0.02
6 changes: 6 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
use inc::Module::Install;
all_from 'lib/Email/Address/List.pm';
readme_from 'lib/Email/Address/List.pm';

requires 'Email::Address';

test_requires 'Test::More';
test_requires 'JSON';

sign;
WriteAll;
46 changes: 43 additions & 3 deletions README
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
NAME
Email::Address::List - RFC close address list parsing

SYNOPSIS
use Email::Address::List;

my $header = <<'END';
Foo Bar <simple@example.com>, (an obsolete comment),,,
a group:
a . wierd . address @
for-real .biz
; invalid thingy, <
more@example.com
>
END

my @list = Email::Address::List->parse($header);
foreach my $e ( @list ) {
if ($e->{'type'} eq 'mailbox') {
print "an address: ", $e->{'value'}->format ,"\n";
}
else {
print $e->{'type'}, "\n"
}
}

# prints:
# an address: "Foo Bar" <simple@example.com>
# comment
# group start
# an address: a.wierd.address@forreal.biz
# group end
# unknown
# an address: more@example.com

DESCRIPTION
Parser for From, To, Cc, Bcc, Reply-To, Sender and previous prefixed
with Resent- (eg Resent-From) headers.
Expand All @@ -10,13 +42,15 @@ REASONING
mentioned headers and this module is derived work from Email::Address.

However, mentioned headers are structured and contain lists of
addresses. Most of the time you want to parse it from start to end
keeping every bit even if it's a invalid input.
addresses. Most of the time you want to parse such field from start to
end keeping everything even if it's an invalid input.

METHODS
parse
A class method that takes a header value (w/o name and :) and a set of
named options. See below.
named options, for example:

my @list = Email::Address::List->parse( $line, option => 1 );

Returns list of hashes. Each hash at least has 'type' key that describes
the entry. Types:
Expand Down Expand Up @@ -84,3 +118,9 @@ METHODS
Skip anything that is not recognizable. It still tries to recover as
described earlier.

AUTHOR
Ruslan Zakirov <ruz@bestpractical.com>

LICENSE
Under the same terms as Perl itself.

53 changes: 50 additions & 3 deletions lib/Email/Address/List.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,39 @@ use Email::Address;
Email::Address::List - RFC close address list parsing
=head1 SYNOPSIS
use Email::Address::List;
my $header = <<'END';
Foo Bar <simple@example.com>, (an obsolete comment),,,
a group:
a . wierd . address @
for-real .biz
; invalid thingy, <
more@example.com
>
END
my @list = Email::Address::List->parse($header);
foreach my $e ( @list ) {
if ($e->{'type'} eq 'mailbox') {
print "an address: ", $e->{'value'}->format ,"\n";
}
else {
print $e->{'type'}, "\n"
}
}
# prints:
# an address: "Foo Bar" <simple@example.com>
# comment
# group start
# an address: a.wierd.address@forreal.biz
# group end
# unknown
# an address: more@example.com
=head1 DESCRIPTION
Parser for From, To, Cc, Bcc, Reply-To, Sender and
Expand All @@ -21,15 +54,18 @@ even mentioned headers and this module is derived work
from Email::Address.
However, mentioned headers are structured and contain lists
of addresses. Most of the time you want to parse it from start
to end keeping every bit even if it's a invalid input.
of addresses. Most of the time you want to parse such field
from start to end keeping everything even if it's an invalid
input.
=head1 METHODS
=head2 parse
A class method that takes a header value (w/o name and :) and
a set of named options. See below.
a set of named options, for example:
my @list = Email::Address::List->parse( $line, option => 1 );
Returns list of hashes. Each hash at least has 'type' key that
describes the entry. Types:
Expand Down Expand Up @@ -352,3 +388,14 @@ sub _process_mailbox {
}


=head1 AUTHOR
Ruslan Zakirov E<lt>ruz@bestpractical.comE<gt>
=head1 LICENSE
Under the same terms as Perl itself.
=cut

1;

0 comments on commit 59a0e6c

Please sign in to comment.