e =~ /\.json$/i)
? $self->_load_json($file_name)
: ($file_name =~ /\.xml$/i)
? $self->_load_xml($file_name)
: die "Expected '$file_name' to end with .yaml, .json or .xm
ile(shift);
}
sub _load_json {
my $self = shift;
require JSON::XS;
my $json = do { local $/; open my $json, '<', shift; <$json> };
JSON::XS::decode_json($json);
}
sub _load_xml {
ats are YAML, JSON and XML. The format
is determined by the file extension, so use the appropriate one. Note
that XML::Simple is used to parse XML files and JSON::XS is used to parse
JSON files.
=ite
ify this data in a file or with a hash reference.
The currently supported file formats are YAML, JSON and XML. The format is
determined by the file extension, so use the appropriate one. Note the
XML