CSVUtils/csv_info.pm

filter: Statementstmt 85.0% 17 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod n/a totaltotal 84.0% 21 / 25 CC 1 SCAR 1.8
CC
1
Cov
85%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« CSVUtils/csv2td.pm ↑ Summary CSVUtils/csv_quote.pm »
1 package App::CSVUtils::csv_info;
2  
3 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
8 1 our $DATE = '2026-07-09'; # DATE
9 1 our $DIST = 'App-CSVUtils'; # DIST
10 1 our $VERSION = '1.038'; # VERSION
11  
12 1 ▶use App::CSVUtils qw(gen_csv_util);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 gen_csv_util(
15 name => 'csv_info',
16 summary => 'Show information about CSV file (number of rows, fields, etc)',
17 description => <<'MARKDOWN',
18  
19  
20 MARKDOWN
21  
22 add_args => {
23 },
24  
25 examples => [
26 {
27 summary => 'Show information on a CSV file',
28 argv => ['file.csv'],
29 test => 0,
30 'x.doc.show_result' => 0,
31 },
32 ],
33  
34 writes_csv => 0,
35  
36 tags => ['category:information'],
37  
38 0 ▶ after_close_input_files => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
39 0 my $r = shift;
40  
41 $r->{result} = [200, "OK", {
42 0 field_count => scalar @{$r->{input_fields}},
43 fields => $r->{input_fields},
44  
45 row_count => $r->{input_header_row_count} + $r->{input_data_row_count},
46 header_row_count => $r->{input_header_row_count},
47 data_row_count => $r->{input_data_row_count},
48  
49 # XXX this is incorrect, we have set encoding to utf-8 so handle
50 # position != number of bytes
51 #file_size => (-s $r->{input_fh}),
52 0 }];
53 }
54 1 );
55  
56 1 1;
57 # ABSTRACT: Show information about CSV file (number of rows, fields, etc)
58  
59 __END__
« CSVUtils/csv2td.pm ↑ Summary CSVUtils/csv_quote.pm »