Re: Email::Address::XS
[email protected] Tue, 23 Aug 2016 09:50:03 +0200
| Newsgroups | perl.pep |
|---|---|
| Message-ID | <20160823075003.GA24323@pali> |
On Monday 22 August 2016 22:26:09 Ricardo Signes wrote:
> Here's a verbose form:
>
> # Get an email.
> my $email = get_some_email_mime();
>
> # Get the header -- the (unfolded) raw bytes.
> my $cc_hdr = $email->header_raw('Original-CC');
>
> # parse it into an object
> my $cc_obj = parse_mailboxes( $cc_obj );
>
> # put that object into the header:
> $email->header_set('Original-CC', $cc_obj);
>
> # get the raw mime-encoded bytes again:
> my $cc_hdr2 = $email->header_raw('Original-CC');
>
> # get a list of sub-object from the object's imaginary interface:
> my @boxes = $email->header_obj('Original-CC')->boxes;
That is really bad API :-( User of Email::MIME is really not interested
in getting RAW header and then manually converting it to some object
(provided by parse_mailboxes), then putting it back to Email::MIME
object... Email::MIME is there for doing whole MIME encoding/decoding
and basically user should not need to call any RAW method (only in case
when he needs to manually encode/decode MIME parts).
And I would expect from Email::MIME to do that encoding/decoding also
for From, To, CC... headers...