package Data::Properties::JSON;
use strict;
use warnings 'all';
use JSON::XS;
our $VERSION = '0.004';
sub new
{
my ($class, %args) = @_;
if( $args{properties_file} )
{
$args{__name} =
reading: $!";
local $/;
$args{data} = decode_json(scalar(<$ifh>));
}
elsif( $args{json} )
{
$args{data} = decode_json($args{json});
$args{__name} = 'root';
}
elsif( $args{da
ta} )
{
$args{__name} ||= 'root';
}
else
{
die "Neither properties_file nor json nor data were provided.";
}# end if()
my $s = bless \%args, $class;
if( ref($s->{data}) eq 'HA