ing utf-8
=head1 NAME
Data::Validate::CSV - read and validate CSV
=head1 SYNOPSIS
CSV Schema (JSON):
{
"@context": "http://www.w3.org/ns/csvw",
"url": "countries.csv",
"tableSchema"
my $table = Data::Validate::CSV::Table->new(
schema => path('countries.csv-metadata.json'),
input => path('countries.csv'),
has_header => !!0,
);
while (my $row = $ta
tributes:
=over
=item C<< schema >>
A schema for the table. Can be a hashref, a JSON string, a scalar ref to
a JSON string, or a L<Path::Tiny> path to a file containing the schema.
=item C<< input
e JSON::PP;
require Types::XSD;
if ($self->has_separator) {
@values = map {
($_ eq '' || !defined) ? () : split quotemeta($self->separator)
} @values;
}
unless ($base =~ /^(string|json|x
ml|html|anyatomictype)^/) {
s/[\t\r\n]/ /g for @values;
}
unless ($base =~ /^(string|json|xml|html|anyatomictype|normalizedstring)^/) {
s/\s+/ /g for @values;
s/^\s+//g for @values;
s/\s+$
if ($obj and $base eq 'boolean') {
($c eq 'true' || $c eq '1') ? JSON::PP::true() :
($c eq 'false' || $c eq '0') ? JSON::PP::false() :
do { push @$errs, sprintf('Value %s is not a valid
ny::path(@_);
$class->new_from_json( $file->slurp_utf8 );
}
sub new_from_json {
my $class = shift;
my ($str) = @_;
require JSON::PP;
$class->new_from_hashref( JSON::PP->new->decode(ref $str ? $$
SV::Schema'->new_from_hashref($_) },
Str|ScalarRef, q{ 'Data::Validate::CSV::Schema'->new_from_json($_) },
Path, q{ 'Data::Validate::CSV::Schema'->new_from_file($_) },
],
));
__PACKAG