On Thu, 30 Jul 2020 08:54:14 GMT, SREZIC wrote:
Show quoted text> If csv-info is used with text output, then the value of the fields key
> is not optimal:
>
> +------------------+-----------------------+
> | key | value |
> +------------------+-----------------------+
> ...
> | fields | ARRAY(0x55db2e4b8ce8) |
> ...
>
> In this case, a comma-separated list would be better, or alternatively
> the multiple values could go into separate lines, possibly with pseudo
> keys like "fields[0]", "fields[1]" etc.
If you try a few times, sometimes you get a JSON. This is because the data structure renderer, Perinci::Result::Format::Lite, didn't try hard (only looked at at most 5 elements) to detect an array of scalar, or array of hash-of-scalars, etc. Now in Perinci::Result::Format::Lite 0.277 I make it try harder (max=1000) so csv-info will now output JSON, I hope you don't mind.
Sample output:
$ PERL5OPT=-Ilib csv-info ~/tmp/1.csv --sep ';'
[
200,
"OK",
{
"data_row_count" : 3,
"field_count" : 3,
"fields" : [
"a",
"b",
"c"
],
"file_size" : 38,
"header_row_count" : 0,
"row_count" : 3
},
{
"stream" : 0
}
]