1 package Config::Any::JSON;
8 Config::Any::JSON - Load JSON config files
12 Loads JSON files. Example:
28 return an array of valid extensions (C<json>, C<jsn>).
33 return qw( json jsn );
38 Attempts to load C<$file> as a JSON file.
46 open( my $fh, $file ) or die $!;
47 my $content = do { local $/; <$fh> };
50 eval { require JSON::Syck; };
53 return JSON::jsonToObj( $content );
56 return JSON::Syck::Load( $content );
60 =head2 is_supported( )
62 Returns true if either L<JSON::Syck> or L<JSON> is available.
67 eval { require JSON::Syck; };
69 eval { require JSON; };
75 Brian Cassidy E<lt>bricas@cpan.orgE<gt>
77 =head1 COPYRIGHT AND LICENSE
79 Copyright 2007 by Brian Cassidy
81 This library is free software; you can redistribute it and/or modify
82 it under the same terms as Perl itself.
90 =item * L<Config::Any>