App-CSVUtils

 view release on metacpan or  search on metacpan

script/csv-check-field-values  view on Meta::CPAN

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2025-02-04'; # DATE
our $DIST = 'App-CSVUtils'; # DIST
our $VERSION = '1.036'; # VERSION

my $cmdline = Perinci::CmdLine::Any->new(
    url => "/App/CSVUtils/csv_check_field_values/csv_check_field_values",
    program_name => "csv-check-field-values",
    log => 1,
    read_config => 0,
    read_env => 0,
    use_utf8 => 1,
);

$cmdline->run;

# ABSTRACT: Check the values of whole fields against code/schema
# PODNAME: csv-check-field-values

__END__

=pod

=encoding UTF-8

=head1 NAME

csv-check-field-values - Check the values of whole fields against code/schema

=head1 VERSION

This document describes version 1.036 of csv-check-field-values (from Perl distribution App-CSVUtils), released on 2025-02-04.

=head1 SYNOPSIS

B<csv-check-field-values> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)

B<csv-check-field-values> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)

B<csv-check-field-values> [B<L<--debug|/"--debug">>|B<L<--log-level|/"--log-level=s">>=I<level>|B<L<--quiet|/"--quiet">>|B<L<--trace|/"--trace">>|B<L<--verbose|/"--verbose">>] [B<L<--format|/"--format=s">>=I<name>|B<L<--json|/"--json">>] [B<L<--input...

=head1 DESCRIPTION

Example C<input.csv>:

 ingredient,%weight
 foo,81
 bar,9
 baz,10

Example C<input2.csv>:

 ingredient,%weight
 foo,81
 bar,9
 baz,10

Check that ingredients are sorted in descending %weight:

 % csv-check-field-values input.csv %weight --with-schema array::num::rev_sorted
 ERROR 400: Field '%weight' does not validate with schema 'array::num::rev_sorted'
 
 % csv-check-field-values input2.csv %weight --with-schema array::num::rev_sorted
 Field '%weight' validates with schema 'array::num::rev_sorted'

=head1 OPTIONS

C<*> marks required options.

=head2 Main options

=over

=item B<--field>=I<s>*, B<-f>

Field name.

Can also be specified as the 2nd command-line argument.

=item B<--input-skip-num-lines>=I<s>

Number of lines to skip before header row.

This can be useful if you have a CSV files (usually some generated reports,
sometimes converted from spreadsheet) that have additional header lines or info
before the CSV header row.

See also the alternative option: C<--input-skip-until-pattern>.


=item B<--input-skip-until-pattern>=I<s>

Skip rows until the first header row matches a regex pattern.

This is an alternative to the C<--input-skip-num-lines> and can be useful if you
have a CSV files (usually some generated reports, sometimes converted from
spreadsheet) that have additional header lines or info before the CSV header
row.

With C<--input-skip-num-lines>, you skip a fixed number of lines. With this
option, rows will be skipped until the first field matches the specified regex
pattern.


=item B<--quiet-arg>, B<-q>

(No description)


=item B<--with-code-json>=I<s>

Check with Perl code (JSON-encoded).

See C<--with-code>.

=item B<--with-code>=I<s>

Check with Perl code.

Code will be given the value of the rows of the field as an array of scalars and
should return a true value if value is valid.


=item B<--with-schema-json>=I<s>



( run in 0.907 second using v1.01-cache-2.11-cpan-140bd7fdf52 )