From f8a14e6b68f67cdd404725a85c9ad1622a0602bd Mon Sep 17 00:00:00 2001 From: sboyette Date: Fri, 28 Aug 2009 20:31:27 +0000 Subject: [PATCH] shuffling around, adding POD stubs git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1756 9efc2488-bf62-4759-914b-345cdb29e865 --- src/perl/lib/OpenSRF/Utils/JSON.pm | 76 ++++++++++++++++++++++++++++---------- 1 file changed, 56 insertions(+), 20 deletions(-) diff --git a/src/perl/lib/OpenSRF/Utils/JSON.pm b/src/perl/lib/OpenSRF/Utils/JSON.pm index c9d8248..0c28518 100644 --- a/src/perl/lib/OpenSRF/Utils/JSON.pm +++ b/src/perl/lib/OpenSRF/Utils/JSON.pm @@ -16,10 +16,49 @@ OpenSRF::Utils::JSON - Bucket-o-Routines for JSON =head1 SYNOPSIS +C is a functional-style package which exports nothing. All +calls to routines must use the fully-qualified name, and expect an +invocant, as in + OpenSRF::Utils::JSON->JSON2perl($string); + +Most routines are straightforward data<->JSON transformation wrappers +around L, but some (like L) provide +OpenSRF functionality. =head1 ROUTINES +=head2 register_class_hint + +=cut + +sub register_class_hint { + my $class = shift; + my %args = @_; + $_class_map{hints}{$args{hint}} = \%args; + $_class_map{classes}{$args{name}} = \%args; +} + +=head2 lookup_class + +=cut + +sub lookup_class { + my $self = shift; + my $hint = shift; + return $_class_map{hints}{$hint}{name} +} + +=head2 lookup_hint + +=cut + +sub lookup_hint { + my $self = shift; + my $class = shift; + return $_class_map{classes}{$class}{hint} +} + =head2 JSON2perl =cut @@ -51,7 +90,7 @@ sub rawJSON2perl { return $parser->decode($json); } -=head2 perl2JSON +=head2 rawPerl2JSON =cut @@ -60,6 +99,10 @@ sub rawPerl2JSON { return $parser->encode($perl); } +=head2 JSONObject2Perl + +=cut + sub JSONObject2Perl { my $class = shift; my $obj = shift; @@ -89,6 +132,10 @@ sub JSONObject2Perl { return $obj; } +=head2 perl2JSONObject + +=cut + sub perl2JSONObject { my $class = shift; my $obj = shift; @@ -115,31 +162,20 @@ sub perl2JSONObject { return $newobj; } +=head2 true + +=cut + sub true { return $parser->true(); } -sub false { - return $parser->false(); -} - -sub register_class_hint { - my $class = shift; - my %args = @_; - $_class_map{hints}{$args{hint}} = \%args; - $_class_map{classes}{$args{name}} = \%args; -} +=head2 false -sub lookup_class { - my $self = shift; - my $hint = shift; - return $_class_map{hints}{$hint}{name} -} +=cut -sub lookup_hint { - my $self = shift; - my $class = shift; - return $_class_map{classes}{$class}{hint} +sub false { + return $parser->false(); } sub _json_hint_to_class { -- 2.11.0