[Opensrf-commits] r1756 - trunk/src/perl/lib/OpenSRF/Utils (sboyette)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Aug 28 16:31:32 EDT 2009


Author: sboyette
Date: 2009-08-28 16:31:27 -0400 (Fri, 28 Aug 2009)
New Revision: 1756

Modified:
   trunk/src/perl/lib/OpenSRF/Utils/JSON.pm
Log:
shuffling around, adding POD stubs

Modified: trunk/src/perl/lib/OpenSRF/Utils/JSON.pm
===================================================================
--- trunk/src/perl/lib/OpenSRF/Utils/JSON.pm	2009-08-25 18:51:00 UTC (rev 1755)
+++ trunk/src/perl/lib/OpenSRF/Utils/JSON.pm	2009-08-28 20:31:27 UTC (rev 1756)
@@ -16,10 +16,49 @@
 
 =head1 SYNOPSIS
 
+C<O::U::JSON> 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<JSON::XS>, but some (like L</register_class_hint>) 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 @@
     return $parser->decode($json);
 }
 
-=head2 perl2JSON
+=head2 rawPerl2JSON
 
 =cut
 
@@ -60,6 +99,10 @@
     return $parser->encode($perl);
 }
 
+=head2 JSONObject2Perl
+
+=cut
+
 sub JSONObject2Perl {
     my $class = shift;
     my $obj = shift;
@@ -89,6 +132,10 @@
     return $obj;
 }
 
+=head2 perl2JSONObject
+
+=cut
+
 sub perl2JSONObject {
     my $class = shift;
     my $obj = shift;
@@ -115,33 +162,22 @@
     return $newobj;
 }
 
+=head2 true
+
+=cut
+
 sub true {
     return $parser->true();
 }
 
+=head2 false
+
+=cut
+
 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;
-}
-
-sub lookup_class {
-    my $self = shift;
-    my $hint = shift;
-    return $_class_map{hints}{$hint}{name}
-}
-
-sub lookup_hint {
-    my $self = shift;
-    my $class = shift;
-    return $_class_map{classes}{$class}{hint}
-}
-
 sub _json_hint_to_class {
     my $type = shift;
     my $hint = shift;



More information about the opensrf-commits mailing list