#!/usr/bin/env perl
use strict;
use warnings;
use File::Basename;
use YAML::XS qw(LoadFile);
use JSON::XS;
use feature 'say';
# Check if the input file exists
my $input_file = shift;
die "Error: File
t_file, qr/\.[^.]*/ );
# output file name is same as input filename with json as suffix
my $output_file = $path . $name . '.json';
# Load the YAML file into a hash reference
print "Loading YAML from
$@\n";
}
# Create a JSON encoder object with pretty formatting
my $json = JSON::XS->new->pretty->utf8;
# Convert the hash reference to JSON and write to file
print "Writing JSON to $output_file...\n
l
# use 5.010;
# use strict;
# use warnings;
# use feature 'say';
use YAML::XS qw(LoadFile);
use JSON::XS;
use Data::Dumper::Concise;
use Getopt::Long;
use File::Basename;
# use FindBin; # path to
ile to analyze (default: aliases.yml)
--format -t FORMAT Explicitly specify format: YAML or JSON
(default: auto-detect from file extension)
--debug, -d Enab
x =~ /^(ya?ml)$/i ) {
$format = 'YAML';
}
elsif ( $suffix =~ /^(json|jsn)$/i ) {
$format = 'JSON';
}
else {
die
"Unable to determine file format from extension:
Alternative configurations are commented out in the script:
# my $alias_file_path = 'aliases.json';
# my $alias_file_path = 'good_aliases.yml';
=head2 Aliases File Format
The aliases file sho