1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#!/usr/bin/env perl
use 5.014002;
use strict;
use warnings;
use File::ShareDir qw[dist_file];
use File::Slurp;
use Zonemaster::Engine::Profile;
my $json_file = @ARGV ? $ARGV[0] : dist_file( 'Zonemaster-Engine', 'profile.json');
my $json = read_file( $json_file );
my $profile = Zonemaster::Engine::Profile->from_json( $json );
my $yaml = $profile->to_yaml();
say $yaml;
=head1 NAME
json2yaml - Convert a JSON profile into YAML
=head1 SYNOPSIS
./json2yaml.pl
./json2yaml.pl profile.json
=head1 DESCRIPTION
json2yaml converts a JSON profile into YAML. The JSON profile can be passed as
an argument. If no argument is provided, the script will look for the default
profile. The YAML profile is written to the standard output.
=cut
|