ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/JSON-XS/XS.pm
(Generate patch)

Comparing JSON-XS/XS.pm (file contents):
Revision 1.48 by root, Mon Jun 25 22:11:39 2007 UTC vs.
Revision 1.50 by root, Mon Jul 2 00:29:38 2007 UTC

9 # exported functions, they croak on error 9 # exported functions, they croak on error
10 # and expect/generate UTF-8 10 # and expect/generate UTF-8
11 11
12 $utf8_encoded_json_text = to_json $perl_hash_or_arrayref; 12 $utf8_encoded_json_text = to_json $perl_hash_or_arrayref;
13 $perl_hash_or_arrayref = from_json $utf8_encoded_json_text; 13 $perl_hash_or_arrayref = from_json $utf8_encoded_json_text;
14
15 # objToJson and jsonToObj aliases to to_json and from_json
16 # are exported for compatibility to the JSON module,
17 # but should not be used in new code.
18 14
19 # OO-interface 15 # OO-interface
20 16
21 $coder = JSON::XS->new->ascii->pretty->allow_nonref; 17 $coder = JSON::XS->new->ascii->pretty->allow_nonref;
22 $pretty_printed_unencoded = $coder->encode ($perl_scalar); 18 $pretty_printed_unencoded = $coder->encode ($perl_scalar);
88use strict; 84use strict;
89 85
90our $VERSION = '1.4'; 86our $VERSION = '1.4';
91our @ISA = qw(Exporter); 87our @ISA = qw(Exporter);
92 88
93our @EXPORT = qw(to_json from_json objToJson jsonToObj); 89our @EXPORT = qw(to_json from_json);
94 90
95use Exporter; 91use Exporter;
96use XSLoader; 92use XSLoader;
97 93
98=head1 FUNCTIONAL INTERFACE 94=head1 FUNCTIONAL INTERFACE
806still relatively early in its development. If you keep reporting bugs they 802still relatively early in its development. If you keep reporting bugs they
807will be fixed swiftly, though. 803will be fixed swiftly, though.
808 804
809=cut 805=cut
810 806
811our $true = do { bless \(my $dummy = 1), "JSON::XS::Boolean" }; 807our $true = do { bless \(my $dummy = "1"), "JSON::XS::Boolean" };
812our $false = do { bless \(my $dummy = 0), "JSON::XS::Boolean" }; 808our $false = do { bless \(my $dummy = "0"), "JSON::XS::Boolean" };
813 809
814sub true() { $true } 810sub true() { $true }
815sub false() { $false } 811sub false() { $false }
816 812
817sub is_bool($) { 813sub is_bool($) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines