]> Dogcows Code - chaz/p5-CGI-Ex/blobdiff - lib/CGI/Ex/Conf.pm
CGI::Ex 2.22
[chaz/p5-CGI-Ex] / lib / CGI / Ex / Conf.pm
index 322fd1c1c80649fc7f3ad5fc52eb8fab4973d70b..365ece2d057b1fbd4640364a1502aea478e5e6d0 100644 (file)
@@ -7,7 +7,7 @@ CGI::Ex::Conf - Conf Reader/Writer for many different data format types
 =cut
 
 ###----------------------------------------------------------------###
-#  Copyright 2006 - Paul Seamons                                     #
+#  Copyright 2007 - Paul Seamons                                     #
 #  Distributed under the Perl Artistic License without warranty      #
 ###----------------------------------------------------------------###
 
@@ -25,10 +25,11 @@ use vars qw($VERSION
             %CACHE
             $HTML_KEY
             @EXPORT_OK
+            $NO_WARN_ON_FAIL
             );
 @EXPORT_OK = qw(conf_read conf_write in_cache);
 
-$VERSION = '2.04';
+$VERSION = '2.22';
 
 $DEFAULT_EXT = 'conf';
 
@@ -133,8 +134,8 @@ sub conf_read {
 
   ### don't die if the file is not found - do die otherwise
   if (! -e $file) {
-      eval { die "Conf file $file not found" };
-      warn "Conf file $file not found" if ! $args->{'no_warn_on_fail'};
+      eval { die "Conf file $file not found\n" };
+      warn "Conf file $file not found" if ! $args->{'no_warn_on_fail'} && ! $NO_WARN_ON_FAIL;
       return;
   }
 
@@ -261,6 +262,7 @@ sub read_handler_json {
   open (IN, $file) || die "Couldn't open $file: $!";
   CORE::read(IN, my $text, -s $file);
   close IN;
+  require JSON;
   return scalar JSON::jsonToObj($text);
 }
 
@@ -803,7 +805,7 @@ conf_read and conf_write method calls.
 
 =head1 FUNCTIONS
 
-=over4
+=over 4
 
 =item conf_read
 
@@ -866,6 +868,10 @@ Should be a windows style ini file.  See L<Config::IniHash>
 
 Should be an xml file.  It will be read in by XMLin.  See L<XML::Simple>.
 
+=item C<json>
+
+Should be a json file.  It will be read using the JSON library.  See L<JSON>.
+
 =item C<html> and C<htm>
 
 This is actually a custom type intended for use with CGI::Ex::Validate.
@@ -904,13 +910,13 @@ without even opening the file.
 
 Make a similar write method that handles immutability.
 
-=head1 AUTHOR
-
-Paul Seamons
-
 =head1 LICENSE
 
 This module may be distributed under the same terms as Perl itself.
 
+=head1 AUTHOR
+
+Paul Seamons <perl at seamons dot com>
+
 =cut
 
This page took 0.020874 seconds and 4 git commands to generate.