Re: Email::Address::XS

[email protected] (Ricardo Signes) Mon, 22 Aug 2016 22:26:09 -0400
Newsgroups perl.pep
Message-ID <20160823022609.GA25768@debian>
--+QahgC5+KEYLbs62
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* [email protected] [2016-08-18T17:35:10]
> On Thursday 18 August 2016 23:21:28 Ricardo Signes wrote:
> > As you say, 1 and 2 are dealt with.  For 3 or 4, you want to have an
> > object in the header slot, rather than a string.  Once you've done
> > that, you use its methods.  If the object's To field stores a
> > string, you "upgrade" it with something like:
> >=20
> >   $email->header(To =3D> mailbox_headers_from( $email->header('To') );
> >=20
> > ...and it seems like one would quickly amass some sort of routine
> > like:
> >=20
> >   upgrade_headers($email);
> >=20
> > ...that would upgrade all the headers it knows about.
>=20
> Can you describe (or write code) how you imagine that I get header=20
> "Original-Cc" in form of addresses in list of named groups from email=20
> which is stored in string scalar? I'm not sure that I understand how you=
=20
> mean it...

Here's a verbose form:

  # Get an email.
  my $email   =3D get_some_email_mime();

  # Get the header -- the (unfolded) raw bytes.
  my $cc_hdr  =3D $email->header_raw('Original-CC');

  # parse it into an object
  my $cc_obj  =3D 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 =3D $email->header_raw('Original-CC');

  # get a list of sub-object from the object's imaginary interface:
  my @boxes   =3D $email->header_obj('Original-CC')->boxes;

--=20
rjbs

--+QahgC5+KEYLbs62
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJXu7RBAAoJEOYby6cMccU5WwYH/1K6pFlfgFO7hshnlpdMpTj/
nH+TLgeLklEAbD/o6u94jchzIgaYL+pSFvrQqHdQzhXKjM+JOzjXnlRnRpnC0Ry3
gVu/JM/UiuqrU+7qqD2fI1j/tKskvkk4JXDNk92wj8bNEQO5GFzd3EAwZjWJu9zq
gehb/yeg8o/4EsgVY3Eqgn3XYERmrDsEiKQPnvxyBZGDmXOxfSolwljkC7o9loEb
6fETYopQJ7hX60uxc0y+uRhuwOhjZM9S0Myy8qXoOqqHw+BZOW+AK5S95I+9SiKA
KIrgYFDq9Vs6y4+evUjeTRU47D5vXI1NhnF0belgp+vG5YV7VlDLu0LwXgf56wo=
=DvjP
-----END PGP SIGNATURE-----

--+QahgC5+KEYLbs62--