in reply to CSV headers. Feedback wanted

I like the idea. My comments:

A quick skim of the documented options suggests the following candidates for auto-detection: BOM (encoding), eol, quote, escape_char, allow_whitespace (set only), allow_loose_quote (set only), allow_loose_escapes (set only), quote_empty. Several of those will be undeterminable from just the header (in which case should remain as default), but if detected should set the parameter.

Good Day,
    Dean

Replies are listed 'Best First'.
Re^2: CSV headers. Feedback wanted
by Tux (Canon) on Feb 10, 2016 at 15:33 UTC
    • key/value pairs: I think I agree, but having the thing being used most like as suggested fits better with the other methods. Nothing carved in stone yet, though
    • defaults. Once the API stabalized, I'll add them more clearly
    • auto-detect. Good thought. All auto-detection on, and disable with key/value options. I like that
    • lower case will be the default, but casing can be another option none/lc/uc/tc
    • auto_header? autoconfigure_from_header seems like getting to high an expectation level
    • BOM: yes, definitely
    • eol: no. though possible, it is useless, as readline will only read a line that already is covered by the default eol setting (undef)
    • quote: unreliable. will cause surprises
    • escape: unreliable. will cause surprises
    • allow_whitespace: possibly harmful. If the header contains spaces around the separators, it is likely the data will also have it, but that is not vice-versa.
    • allow_loose_quote: no (see allow_whitespace)
    • allow_loose_escapes: no (see allow_whitespace)
    • quote_empty: no, it is very unlikely a header contains empty fields. If it does, using this new functionality will only cause more trouble than it is worth

    Enjoy, Have FUN! H.Merijn