rjbs / Email-MIME

perl library for parsing MIME messages
20 stars 30 forks source link

Finish object representation of the header value and provides Email::MIME::Header::AddressList #38

Closed pali closed 7 years ago

pali commented 7 years ago

This pull request now contains all remaining commits related to object representation of header value and implemented proper parsing of address-list header according to RFC2047 & RFC2822 via new module Email::MIME::Header::AddressList (which uses Email::Address::XS).

Feel free to comment changes or propose some improvements. Specially documentation for Email::MIME::Header::AddressList could be better, but I'm not native English speaker...

rjbs commented 7 years ago

I think this looks okay to me.

pali commented 7 years ago

this does not make the Email::Address::XS optional, as we discussed, which makes Email::MIME unusable for people without a compiler

It is optional. Email::Address::XS is used only in the new module Email::MIME::Header::AddressList and Email::MIME::Header::AddressList is optional. Whole Email::MIME would work without Email::MIME::Header::AddressList in case it is not needed to parse/deparse Unicode From/To/Cc/Bcc/... headers.

When it is needed to convert Unicode From/To/Cc/Bcc header to byte-MIME-encoded, then it is not possible without Email::Address::XS. We already discussed about it. And so I chose this approach, that whole functionality is in separate module Email::MIME::Header::AddressList which is optional.

a number of routine in Email::MIME::Header are undocumented but have no leading underscore;

Which one?

please normalize indenting to two spaces

Ok!

pali commented 7 years ago

please normalize indenting to two spaces

Done.

Also I fixed tests so they pass without Email::Address::XS.

pali commented 7 years ago

New changes with updated documentation and allowing to pass more arguments for %Email::MIME::Header::header_to_class_map class. It would allow to constructions like:

header_str => [
    ...
    To => [ 'user1@host.com', 'Name <user2@host.com>' ],
    ...
],

(to specify more email addresses as array reference)

pali commented 7 years ago

@rjbs: PING

rjbs commented 7 years ago

The new methods without docs or underscore are:

I have taken the liberty of underscoring them.

rjbs commented 7 years ago

This does not fix indenting to two-space. Look at ed7c2907ecca5ced43c4a50be6e3b4a74edfad7a and Email::MIME::Encode, for example.

I'll do it in a moment.

rjbs commented 7 years ago

I have uploaded Email-MIME-1.943-TRIAL.