added is_supported() to see what plugins we can use
[p5sagit/Config-Any.git] / lib / Config / Any / JSON.pm
index 18b201f..3213128 100644 (file)
@@ -57,6 +57,19 @@ sub load {
     }
 }
 
+=head2 is_supported( )
+
+Returns true if either L<JSON::Syck> or L<JSON> is available.
+
+=cut
+
+sub is_supported {
+    eval { require JSON::Syck; };
+    return 1 unless $@;
+    eval { require JSON; };
+    return $@ ? 0 : 1;
+}
+
 =head1 AUTHOR
 
 Brian Cassidy E<lt>bricas@cpan.orgE<gt>