Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > perl.pep > #10

Re: Email::Address::XS

Newsgroups perl.pep
Date 2016-08-01 19:00 -0400
Subject Re: Email::Address::XS
Message-ID <20160801230002.GA19612@debian> (permalink)
References <201605231905.43786@pali> <201607031439.41051@pali> <20160703235241.GA26626@debian> <201607121743.04001@pali>
From perl.pep@rjbs.manxome.org (Ricardo Signes)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

* pali@cpan.org [2016-07-12T11:43:02]
> On Monday 04 July 2016 01:52:41 Ricardo Signes wrote:
> > 
> > I'd stick to header_str, I think, but I'm not sure.  At any rate:
> > yes.
> 
> And this is what I do not like... to pass objects to function with name 
> header_str. That name sounds like it takes string, not object (or more 
> objects)...

Either we can add a new name, so people end up having to give "header_str" and
"header_obj" or we can say "in general everything uses header_str, which
follows these simple rules."  I would rather do that.

> > > Still do not know how to handle non-MIME headers correctly in
> > > Email::MIME module. We can either create blacklist of non-MIME
> > > headers and extend it every time when somebody report problem or
> > > create whitelist of MIME headers... Or let caller to decide if his
> > > header must be MIME-encoded or not.
> > 
> > I'm sorry, I don't understand.  Could you elaborate?
> 
> If passed pair (header-name, header-value) needs to be MIME encoded or 
> not. Currently there is blacklist in Email::MIME for header names which 
> are never MIME encoded (like Message-Id, Date, ...) when passing as 
> header_str.

So, I'd assume we'd go forward with:

* if you know exactly octets you, the user, want in the header field, use
  "header", but this is likely rare
* if you want to provide a string for a field that's pretty much just a string,
  use header_str and if it requires special handling, we do our best, which
  should get better over time
* but if things are complicated, use an object that represents the structured
  data

I don't like the idea that this will be broken further by adding the object
behavior, though.

  $email->header_str_set($field => $email->header($field));

...should not break things.

> > "header_str" is "text string" which means it will get encoded.
> 
> Not exactly, there are exceptions (Message-Id, Date, ...) plus special 
> behaviour for addresses headers.

Those /mostly/ still get encoded, but we know that the strings are meant to be
structured, so we try to deconstruct them and encode them correctly.
I think those fields that get passed through unchanged are probably in error at
least insofar as they let you put non-7-bit-clean data in your headers.  This
should probably be fatal:

  header_str => [ Date => "\N{SMILING FACE WITH HORNS}" ]

> Addresses and groups are really something different as previous types 
> (strings). And if we threat them as objects, I would rather see e.g. 
> header_obj (or other different name) instead mixing it again with 
> header_str (which already have exceptions :-(). This is my initial 
> reason for header_addr/grps to distinguish it.

My feeling is that Perl programmers are used to polymorphic interfaces, and
that multiplying the number of ways to specify headers is a needless confusion.
What is the benefit to the end user of splitting things up?

-- 
rjbs

Back to perl.pep | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Email::Address::XS pali@cpan.org - 2016-05-23 19:05 +0200
  Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2016-05-28 16:33 -0400
    Re: Email::Address::XS pali@cpan.org - 2016-05-28 22:48 +0200
      Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2016-05-30 20:42 -0400
        Re: Email::Address::XS pali@cpan.org - 2016-06-01 18:44 +0200
          Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2016-06-30 20:51 -0400
            Re: Email::Address::XS pali@cpan.org - 2016-07-03 14:39 +0200
              Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2016-07-03 19:52 -0400
                Re: Email::Address::XS pali@cpan.org - 2016-07-12 17:43 +0200
                Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2016-08-01 19:00 -0400
                Re: Email::Address::XS pali@cpan.org - 2016-08-02 23:03 +0200
                Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2016-08-02 18:36 -0400
                Re: Email::Address::XS pali@cpan.org - 2016-08-08 23:41 +0200
                Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2016-08-18 17:21 -0400
                Re: Email::Address::XS pali@cpan.org - 2016-08-18 23:35 +0200
                Re: Email::Address::XS pali@cpan.org - 2016-08-20 12:01 +0200
                Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2016-08-22 22:34 -0400
                Re: Email::Address::XS pali@cpan.org - 2016-08-23 09:56 +0200
                Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2016-08-24 22:55 -0400
                Re: Email::Address::XS pali@cpan.org - 2016-08-25 09:40 +0200
                Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2016-09-03 18:24 -0400
                Re: Email::Address::XS pali@cpan.org - 2016-09-05 10:25 +0200
                Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2016-09-11 18:58 -0400
                Re: Email::Address::XS pali@cpan.org - 2016-09-12 09:26 +0200
                Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2016-09-16 18:37 -0400
                Re: Email::Address::XS pali@cpan.org - 2016-09-18 01:05 +0200
                Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2016-09-18 11:26 -0400
                Re: Email::Address::XS pali@cpan.org - 2016-09-18 17:40 +0200
                Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2016-09-28 09:29 -0400
                Re: Email::Address::XS pali@cpan.org - 2016-09-30 12:38 +0200
                Re: Email::Address::XS pali@cpan.org - 2016-11-13 03:17 +0100
                Re: Email::Address::XS pali@cpan.org - 2016-11-13 03:24 +0100
                Re: Email::Address::XS pali@cpan.org - 2017-01-14 21:32 +0100
                Re: Email::Address::XS pali@cpan.org - 2017-01-23 14:44 +0100
                Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2017-01-28 15:48 -0500
                Re: Email::Address::XS pali@cpan.org - 2017-02-14 21:26 +0100
                Re: Email::Address::XS pali@cpan.org - 2017-03-08 00:03 +0100
                Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2016-08-22 22:26 -0400
                Re: Email::Address::XS pali@cpan.org - 2016-08-23 09:50 +0200
                Re: Email::Address::XS perl.pep@rjbs.manxome.org (Ricardo Signes) - 2016-08-23 09:31 -0400
  Re: Email::Address::XS pali@cpan.org - 2017-02-18 21:25 +0100

csiph-web