]> Dogcows Code - chaz/p5-CGI-Ex/blobdiff - lib/CGI/Ex/JSONDump.pm
CGI::Ex 2.05
[chaz/p5-CGI-Ex] / lib / CGI / Ex / JSONDump.pm
index fe7c562b2fad2efaeb9e1cf475a6aecddb0e017f..69222bf85bdeb46ab150908394c75e65093d277e 100644 (file)
@@ -17,7 +17,7 @@ use strict;
 use base qw(Exporter);
 
 BEGIN {
-    $VERSION  = '2.04';
+    $VERSION  = '2.05';
 
     @EXPORT = qw(JSONDump);
     @EXPORT_OK = @EXPORT;
@@ -108,8 +108,8 @@ sub js_escape {
     my $quote = $self->{'single_quote'} ? "'" : '"';
 
     $str =~ s/\\/\\\\/g;
-    $str =~ s/\r/\\\r/g;
-    $str =~ s/\t/\\\t/g;
+    $str =~ s/\r/\\r/g;
+    $str =~ s/\t/\\t/g;
     $self->{'single_quote'} ? $str =~ s/\'/\\\'/g : $str =~ s/\"/\\\"/g;
 
     ### allow for really odd chars
@@ -238,7 +238,7 @@ include whitespace to make them more readable.
 with single quotes.  Otherwise values are quoted with double quotes.
 
      JSONDump("a", {single_quote => 0});
-     JSONDump('a', {single_quote => 0});
+     JSONDump("a", {single_quote => 1});
 
      Would print
 
@@ -249,7 +249,7 @@ with single quotes.  Otherwise values are quoted with double quotes.
 
 0 or 1.  Default 1 (true)
 
-If true, then key/value pairs of hashrefs will be sorted will be output in sorted order.
+If true, then key/value pairs of hashrefs will be output in sorted order.
 
 =item play_coderefs
 
@@ -294,9 +294,10 @@ with unknown types will not be included in the javascript output.
 
 =item skip_keys
 
-Should contain an arrayref of keys or a hashref whose keys are the keys to skip.  Default
-is unset.  Any keys of hashrefs that are in the skip_keys item will not be included in
-the javascript output.
+Should contain an arrayref of keys or a hashref whose keys are the
+keys to skip.  Default is unset.  Any keys of hashrefs (including
+nested hashrefs) that are in the skip_keys item will not be included
+in the javascript output.
 
     JSONDump({a => 1, b => 1}, {skip_keys => ['a'], pretty => 0});
 
@@ -306,8 +307,9 @@ the javascript output.
 
 =item skip_keys_qr
 
-Similar to skip_keys but should contain a regex.  Any keys of hashrefs that match the
-skip_keys_qr regex will not be included in the javascript output.
+Similar to skip_keys but should contain a regex.  Any keys of hashrefs
+(including nested hashrefs) that match the skip_keys_qr regex will not
+be included in the javascript output.
 
     JSONDump({a => 1, _b => 1}, {skip_keys_qr => qr/^_/, pretty => 0});
 
@@ -346,7 +348,7 @@ greater than 80 characters.  Default is "\n".
       +"with plenty of embedded newlines\n"
       +"and is greater than 80 characters.\n"
 
-If the string is less than 80 characters, or if str_nl is set to '', then the escaped
+If the string is less than 80 characters, or if str_nl is set to "", then the escaped
 string will be contained on a single line.
 
 =back
This page took 0.025022 seconds and 4 git commands to generate.