Skip Menu |

This queue is for tickets about the App-CSVUtils CPAN distribution.

Report information
The Basics
Id: 133078
Status: resolved
Priority: 0/
Queue: App-CSVUtils

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.029
Fixed in: (no value)



Subject: csv-info: suboptimal output for fields (ARRAY(...))
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.
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 } ]
On 2020-07-30 07:54:25, PERLANCAR wrote: Show quoted text
> On Thu, 30 Jul 2020 08:54:14 GMT, SREZIC wrote:
> > 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 > } > ]
Not perfect, but definitively an improvement. I wonder if in this case --naked-res should automatically be enabled for tidier output?
Subject: Re: [rt.cpan.org #133078] csv-info: suboptimal output for fields (ARRAY(...))
Date: Fri, 31 Jul 2020 09:14:20 +0700
To: bug-App-CSVUtils [...] rt.cpan.org
From: Perl Ancar <perlancar [...] gmail.com>
Your wish is my command. :) On Thu, Jul 30, 2020, 19:36 Slaven_Rezic via RT < bug-App-CSVUtils@rt.cpan.org> wrote: Show quoted text
> Queue: App-CSVUtils > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=133078 > > > On 2020-07-30 07:54:25, PERLANCAR wrote:
> > On Thu, 30 Jul 2020 08:54:14 GMT, SREZIC wrote:
> > > 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 > > } > > ]
> > Not perfect, but definitively an improvement. I wonder if in this case > --naked-res should automatically be enabled for tidier output? > >
Subject: Re: [rt.cpan.org #133078] csv-info: suboptimal output for fields (ARRAY(...))
Date: Fri, 31 Jul 2020 10:31:54 +0700
To: bug-App-CSVUtils [...] rt.cpan.org
From: Perl Ancar <perlancar [...] gmail.com>
Additional note, you can also pass environment PERINCI_CMDLINE_ANY=classic. The data structure renderer used by that backend tries harder to show table or tables. On Fri, Jul 31, 2020, 09:14 Perl Ancar <perlancar@gmail.com> wrote: Show quoted text
> Your wish is my command. :) > > On Thu, Jul 30, 2020, 19:36 Slaven_Rezic via RT < > bug-App-CSVUtils@rt.cpan.org> wrote: >
>> Queue: App-CSVUtils >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=133078 > >> >> On 2020-07-30 07:54:25, PERLANCAR wrote:
>> > On Thu, 30 Jul 2020 08:54:14 GMT, SREZIC wrote:
>> > > 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 >> > } >> > ]
>> >> Not perfect, but definitively an improvement. I wonder if in this case >> --naked-res should automatically be enabled for tidier output? >> >>