Skip to content

Instantly share code, notes, and snippets.

@robrwo
Created October 23, 2013 10:56
Show Gist options
  • Save robrwo/7116544 to your computer and use it in GitHub Desktop.
Save robrwo/7116544 to your computer and use it in GitHub Desktop.
Quick and dirty YAML validator
#!/usr/bin/env perl
use v5.10.1;
use strict;
use warnings;
use Try::Tiny;
use YAML::Any qw/ LoadFile /;
my $errors = 0;
while (my $file = shift) {
try {
LoadFile($file);
say "${file}: ok";
} catch {
say "${file}: $_";
++$errors;
}
}
exit ($errors > 255) ? 255 : $errors;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment