The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/home/ben/software/install/bin/perl
use warnings;
use strict;
use lib '/home/ben/projects/Json3/blib/lib';
use lib '/home/ben/projects/Json3/blib/arch';
use JSON::Parse 'assert_valid_json';
use Path::Tiny;
use Getopt::Long;
my $ok = GetOptions (
"verbose" => \my $verbose,
"help" => \my $help,
);
if (! $ok || $help) {
    usage ();
    exit;
}
for (@ARGV) {
    eval {
	my $file = path ($_);
	my $text = $file->slurp_utf8 ();
	assert_valid_json ($text);
    };
    if ($@) {
	print "$_: $@\n";
    }
    if ($verbose) {
	print "$_ is valid JSON.\n";
    }
}

sub usage
{
    print <<EOF;
$0: validate JSON. Default behaviour is to produce nothing except errors.

Options:

--verbose       Get confirmation that the files are valid.
--help          View this message.

This script requires Path::Tiny and JSON::Parse to be installed.
EOF

    exit;
}