Patch from Dan Scott to move JSON to OpenSRF::Utils::JSON:
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 2 Jul 2007 15:11:35 +0000 (15:11 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 2 Jul 2007 15:11:35 +0000 (15:11 +0000)
I noticed back when I was first installing OpenSRF that it includes a
module, JSON.pm, that exists at the root level of the package
directories. This would be fine, except it conflicts with a CPAN
module that is also named JSON, which confuses the CPAN installer when
you check for upgrades and conceivably could lead to a broken system.

I suggested to Mike that it would probably make sense to move the
OpenSRF version of the module into the OpenSRF/Utils/ package
namespace, and he agreed. Of course, there are ramifications
throughout the code, so I've tried to be extra-careful in catching and
correcting all of the places where the use of this module surfaces in
both OpenSRF and Evergreen.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@7503 dcc99617-32d9-48b4-a31d-7c20da2025e4

41 files changed:
Evergreen/src/extras/import/object_dumper.pl
Evergreen/src/extras/import/parse_patron_xml.pl
Evergreen/src/support-scripts/eg_gen_overdue.pl
Open-ILS/examples/json-request-test.pl
Open-ILS/examples/reporter-sql-builder-test.pl
Open-ILS/src/extras/Perl2REST.pl
Open-ILS/src/extras/import/direct_ingest.pl
Open-ILS/src/extras/import/direct_loader.pl
Open-ILS/src/extras/import/marc2are.pl
Open-ILS/src/extras/import/marc2bre.pl
Open-ILS/src/extras/import/pg_loader.pl
Open-ILS/src/extras/org_tree_js.pl
Open-ILS/src/offline/offline.pl
Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm
Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/HoldNotify.pm
Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm
Open-ILS/src/perlmods/OpenILS/Application/Search.pm
Open-ILS/src/perlmods/OpenILS/Application/Search/Authority.pm
Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm
Open-ILS/src/perlmods/OpenILS/Application/Storage/WORM.pm
Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
Open-ILS/src/perlmods/OpenILS/Application/WoRM.pm
Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkout.pm
Open-ILS/src/perlmods/OpenILS/Template/Plugin/WebUtils.pm
Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm
Open-ILS/src/perlmods/OpenILS/Utils/Editor.pm
Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm
Open-ILS/src/perlmods/OpenILS/Utils/ScriptRunner.pm
Open-ILS/src/perlmods/OpenILS/WWW/AddedContent/Syndetic.pm
Open-ILS/src/perlmods/OpenILS/WWW/Method.pm
Open-ILS/src/reporter/clark-kent.pl
Open-ILS/src/support-scripts/fine_generator.pl
Open-ILS/src/support-scripts/hold_targeter.pl
Open-ILS/src/support-scripts/marc_export
Open-ILS/src/support-scripts/oils_header.pl
Open-ILS/src/support-scripts/test-scripts/notes.pl
Open-ILS/src/support-scripts/test-scripts/offline.pl

index de7f33d..0f69ca4 100755 (executable)
@@ -7,7 +7,7 @@
 
 use strict; 
 use warnings;
-use JSON;
+use OpenSRF::Utils::JSON;
 use OpenSRF::System;
 use OpenILS::Utils::Fieldmapper;
 use OpenSRF::Utils::SettingsClient;
@@ -24,5 +24,5 @@ for my $t (@ARGV) {
        $t =~ s/\./_/og;
        my $m = "retrieve_all_$t";
        my $d = $e->$m();
-       print JSON->perl2JSON($_) . "\n" for @$d;
+       print OpenSRF::Utils::JSON->perl2JSON($_) . "\n" for @$d;
 }
index 0608c85..8e580a2 100755 (executable)
@@ -11,7 +11,7 @@ use OpenSRF::Utils::SettingsClient;
 use OpenILS::Utils::Fieldmapper;
 use Digest::MD5 qw/md5_hex/;
 use Getopt::Long;
-use JSON;
+use OpenSRF::Utils::JSON;
 use DateTime;
 use Time::HiRes qw/time/;
 use XML::LibXML;
@@ -302,7 +302,7 @@ for my $patron ( $doc->documentElement->childNodes ) {
        }
 
        print STDERR "\r$count     ".$count/(time - $starttime) unless ($count % 100);
-       print JSON->perl2JSON( $_ )."\n" for ($p,$card,$profile_sce,@addresses,@notes);
+       print OpenSRF::Utils::JSON->perl2JSON( $_ )."\n" for ($p,$card,$profile_sce,@addresses,@notes);
 
        $count++;
 }
index 6580dab..d503494 100755 (executable)
@@ -21,6 +21,7 @@ use DateTime;
 use Email::Send;
 use DateTime::Format::ISO8601;
 use OpenSRF::Utils qw/:datetime/;
+use OpenSRF::Utils::JSON;
 use Unicode::Normalize;
 use OpenILS::Const qw/:const/;
 
@@ -445,7 +446,7 @@ sub send_email {
        if( my $set = $e->search_actor_org_unit_setting( 
                        { name => 'org.bounced_emails', org_unit => $org->id } )->[0] ) {
 
-               my $bemail = JSON->JSON2perl($set->value);
+               my $bemail = OpenSRF::Utils::JSON->JSON2perl($set->value);
                $errors_to = $bemail if $bemail;
        }
 
index 4ee7935..c75877e 100755 (executable)
@@ -4,7 +4,7 @@ use lib '../src/perlmods/';
 use lib '../../OpenSRF/src/perlmods/';
 use lib '../src/perlmods/OpenILS/Utils/';
 
-use JSON;
+use OpenSRF::Utils::JSON;
 use OpenSRF::System;
 use OpenILS::Utils::ScriptRunner;
 use OpenSRF::Utils::Logger;
@@ -27,8 +27,8 @@ try {
         OpenILS::Utils::ScriptRunner->add_path('../src/javascript/backend/libs/');
         OpenILS::Utils::ScriptRunner->add_path('./');
 
-       print JSON->perl2JSON( OpenILS::Utils::ScriptRunner->new( file => shift(@ARGV) )->run );
-       #print JSON->perl2JSON( OpenILS::Utils::ScriptRunner->new->run( shift(@ARGV) ) );
+       print OpenSRF::Utils::JSON->perl2JSON( OpenILS::Utils::ScriptRunner->new( file => shift(@ARGV) )->run );
+       #print OpenSRF::Utils::JSON->perl2JSON( OpenILS::Utils::ScriptRunner->new->run( shift(@ARGV) ) );
 
 } otherwise {
         warn 'crap:'.shift();
index b7ebb91..d5a1a1f 100755 (executable)
@@ -3,7 +3,7 @@ use diagnostics;
 use warnings;
 use strict;
 use OpenILS::Reporter::SQLBuilder;
-use JSON;
+use OpenSRF::Utils::JSON;
 
 my $report = {
        select => [
@@ -88,7 +88,7 @@ my $report = {
        pivot_label => 2,
 };
 
-$report = JSON->JSON2perl('{"select":[{"relation":"b312819df8fe889b50f70ea9fa054e72","path":"au-home_ou-aou-shortname","alias":"ILS User:Home Library:Short (Policy) Name","column":{"transform":"Bare","colname":"shortname"}},{"relation":"80bfa74cd4909b585f6187fe8f8591c5","path":"au-survey_responses-asvr-survey-asv-name","alias":"ILS User:Survey Responses:survey:name","column":{"transform":"Bare","colname":"name"}},{"relation":"8a6cb366f41b2b8186df7c7749ff41ba","path":"au-survey_responses-asvr-answer-asva-answer","alias":"ILS User:Survey Responses:answer:Answer Text","column":{"transform":"Bare","colname":"answer"}},{"relation":"8bcc25c96aa5a71f7a76309077753e67","path":"au-id","alias":"count","column":{"transform":"count","colname":"id"}}],"from":{"table":"actor.usr","path":"au","alias":"8bcc25c96aa5a71f7a76309077753e67","join":{"id-survey_responses":{"key":"usr","type":"left","table":"action.survey_response","path":"au-survey_responses-asvr","alias":"cab1b47d26fa649f9a795d191bac0642","join":{"survey":{"key":"id","table":"action.survey","path":"au-survey_responses-asvr-survey-asv","alias":"80bfa74cd4909b585f6187fe8f8591c5"},"answer":{"key":"id","table":"action.survey_answer","path":"au-survey_responses-asvr-answer-asva","alias":"8a6cb366f41b2b8186df7c7749ff41ba"}}},"home_ou":{"key":"id","table":"actor.org_unit","path":"au-home_ou-aou","alias":"b312819df8fe889b50f70ea9fa054e72"}}},"where":[{"relation":"80bfa74cd4909b585f6187fe8f8591c5","path":"au-survey_responses-asvr-survey-asv-id","column":{"transform":"Bare","colname":"id"},"condition":{"in":"::P0"}},{"relation":"b312819df8fe889b50f70ea9fa054e72","path":"au-home_ou-aou-id","column":{"transform":"Bare","colname":"id"},"condition":{"in":"::P1"}}],"having":[],"order_by":[]}');
+$report = OpenSRF::Utils::JSON->JSON2perl('{"select":[{"relation":"b312819df8fe889b50f70ea9fa054e72","path":"au-home_ou-aou-shortname","alias":"ILS User:Home Library:Short (Policy) Name","column":{"transform":"Bare","colname":"shortname"}},{"relation":"80bfa74cd4909b585f6187fe8f8591c5","path":"au-survey_responses-asvr-survey-asv-name","alias":"ILS User:Survey Responses:survey:name","column":{"transform":"Bare","colname":"name"}},{"relation":"8a6cb366f41b2b8186df7c7749ff41ba","path":"au-survey_responses-asvr-answer-asva-answer","alias":"ILS User:Survey Responses:answer:Answer Text","column":{"transform":"Bare","colname":"answer"}},{"relation":"8bcc25c96aa5a71f7a76309077753e67","path":"au-id","alias":"count","column":{"transform":"count","colname":"id"}}],"from":{"table":"actor.usr","path":"au","alias":"8bcc25c96aa5a71f7a76309077753e67","join":{"id-survey_responses":{"key":"usr","type":"left","table":"action.survey_response","path":"au-survey_responses-asvr","alias":"cab1b47d26fa649f9a795d191bac0642","join":{"survey":{"key":"id","table":"action.survey","path":"au-survey_responses-asvr-survey-asv","alias":"80bfa74cd4909b585f6187fe8f8591c5"},"answer":{"key":"id","table":"action.survey_answer","path":"au-survey_responses-asvr-answer-asva","alias":"8a6cb366f41b2b8186df7c7749ff41ba"}}},"home_ou":{"key":"id","table":"actor.org_unit","path":"au-home_ou-aou","alias":"b312819df8fe889b50f70ea9fa054e72"}}},"where":[{"relation":"80bfa74cd4909b585f6187fe8f8591c5","path":"au-survey_responses-asvr-survey-asv-id","column":{"transform":"Bare","colname":"id"},"condition":{"in":"::P0"}},{"relation":"b312819df8fe889b50f70ea9fa054e72","path":"au-home_ou-aou-id","column":{"transform":"Bare","colname":"id"},"condition":{"in":"::P1"}}],"having":[],"order_by":[]}');
 
 my $params = {
        PARAM1 => [ 18, 19, 20, 21, 22, 23 ],
@@ -101,7 +101,7 @@ my $params = {
        PARAM7 => 'f',
 };
 
-$params = JSON->JSON2perl('{"P0":["1"],"P1":["1","17","18","20","19","22","24","25","27","21","29","26","28","23","30","226","227","229","230","228","221","222","130","131","132","231","232","233","234","235","223","224","225","135","137","136","138","139","140","141","277","280","279","283","281","282","284","278","133","134","262","263","265","266","264","268","267","43","44","45","46","47","48","285","286","287","296","288","289","299","290","291","292","293","294","295","298","297","300","301","302","31","32","33","34","41","42","121","122","123","125","129","126","124","127","128","168","169","170","171","172","173","194","195","151","154","155","152","153","164","165","167","166","236","237","238","240","239","269","270","271","272","273","274","275","276","118","119","120","243","251","256","244","245","246","247","248","249","250","252","253","255","257","254","258","259","260","261","10","12","11","13","15","14","16","108","109","110","111","112","113","241","242","156","157","158","160","162","163","159","161","303","304","307","306","305","308","310","309","311","207","211","208","209","210","88","89","91","90","212","213","218","215","214","217","216","219","220","70","72","71","74","73","75","76","77","114","115","116","117","196","197","201","199","200","204","202","203","206","198","205","100","101","102","103","104","105","106","107","68","69","98","99","35","38","37","36","39","40","142","143","144","145","146","147","148","149","150","92","93","94","95","96","97","188","189","190","191","192","193","61","62","67","63","64","65","66","78","79","80","81","82","85","84","86","83","87","58","59","60","49","56","50","51","52","54","53","55","57","174","182","175","177","179","180","183","181","184","185","186","187","176","178"]}');
+$params = OpenSRF::Utils::JSON->JSON2perl('{"P0":["1"],"P1":["1","17","18","20","19","22","24","25","27","21","29","26","28","23","30","226","227","229","230","228","221","222","130","131","132","231","232","233","234","235","223","224","225","135","137","136","138","139","140","141","277","280","279","283","281","282","284","278","133","134","262","263","265","266","264","268","267","43","44","45","46","47","48","285","286","287","296","288","289","299","290","291","292","293","294","295","298","297","300","301","302","31","32","33","34","41","42","121","122","123","125","129","126","124","127","128","168","169","170","171","172","173","194","195","151","154","155","152","153","164","165","167","166","236","237","238","240","239","269","270","271","272","273","274","275","276","118","119","120","243","251","256","244","245","246","247","248","249","250","252","253","255","257","254","258","259","260","261","10","12","11","13","15","14","16","108","109","110","111","112","113","241","242","156","157","158","160","162","163","159","161","303","304","307","306","305","308","310","309","311","207","211","208","209","210","88","89","91","90","212","213","218","215","214","217","216","219","220","70","72","71","74","73","75","76","77","114","115","116","117","196","197","201","199","200","204","202","203","206","198","205","100","101","102","103","104","105","106","107","68","69","98","99","35","38","37","36","39","40","142","143","144","145","146","147","148","149","150","92","93","94","95","96","97","188","189","190","191","192","193","61","62","67","63","64","65","66","78","79","80","81","82","85","84","86","83","87","58","59","60","49","56","50","51","52","54","53","55","57","174","182","175","177","179","180","183","181","184","185","186","187","176","178"]}');
 
 my $r = OpenILS::Reporter::SQLBuilder->new;
 
index 6a128f7..5eb8fe0 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 use strict;use warnings;
 use OpenSRF::EX qw/:try/;
-use JSON;
+use OpenSRF::Utils::JSON;
 use OpenSRF::System;
 use OpenSRF::Application;
 use OpenILS::Utils::Fieldmapper;
index a5f3c1e..48060c6 100755 (executable)
@@ -14,7 +14,7 @@ use OpenILS::Application::Ingest;
 use OpenILS::Application::AppUtils;
 use OpenILS::Utils::Fieldmapper;
 use Digest::MD5 qw/md5_hex/;
-use JSON;
+use OpenSRF::Utils::JSON;
 use Data::Dumper;
 use FileHandle;
 
@@ -57,7 +57,7 @@ my $starttime = time;
 while (my $rec = <>) {
        next unless ($rec);
 
-       my $bib = JSON->JSON2perl($rec);
+       my $bib = OpenSRF::Utils::JSON->JSON2perl($rec);
        my $data;
 
        try {
@@ -91,12 +91,12 @@ sub postprocess {
        $bib->fingerprint( $fp->{fingerprint} ) unless ($auth);
        $bib->quality( $fp->{quality} ) unless ($auth);
 
-       print( JSON->perl2JSON($bib)."\n" );
+       print( OpenSRF::Utils::JSON->perl2JSON($bib)."\n" );
        unless ($auth) {
-               print( JSON->perl2JSON($rd)."\n" );
-               print( JSON->perl2JSON($_)."\n" ) for (@$field_entries);
+               print( OpenSRF::Utils::JSON->perl2JSON($rd)."\n" );
+               print( OpenSRF::Utils::JSON->perl2JSON($_)."\n" ) for (@$field_entries);
        }
 
-       print( JSON->perl2JSON($_)."\n" ) for (@$full_rec);
+       print( OpenSRF::Utils::JSON->perl2JSON($_)."\n" ) for (@$full_rec);
 }
 
index ea5c7f2..45f7a56 100755 (executable)
@@ -14,7 +14,7 @@ use OpenILS::Application::Storage;
 use OpenILS::Application::AppUtils;
 use OpenILS::Utils::Fieldmapper;
 use Digest::MD5 qw/md5_hex/;
-use JSON;
+use OpenSRF::Utils::JSON;
 use Data::Dumper;
 use FileHandle;
 
@@ -57,7 +57,7 @@ my $starttime = time;
 while ( my $rec = <> ) {
        next unless ($rec);
 
-       my $row = JSON->JSON2perl($rec);
+       my $row = OpenSRF::Utils::JSON->JSON2perl($rec);
 
        OpenSRF::Application->method_lookup( "$base.push" )->run($row); 
 
index 3391bc4..652a6a6 100755 (executable)
@@ -13,7 +13,7 @@ use OpenSRF::Utils::SettingsClient;
 use OpenILS::Application::AppUtils;
 use OpenILS::Utils::Fieldmapper;
 use Digest::MD5 qw/md5_hex/;
-use JSON;
+use OpenSRF::Utils::JSON;
 use Data::Dumper;
 use Unicode::Normalize;
 
@@ -80,7 +80,7 @@ while ( try { $rec = $batch->next } otherwise { $rec = -1 } ) {
        $bib->arn_value($count);
        $bib->last_xact_id('IMPORT-'.$starttime);
 
-       print JSON->perl2JSON($bib)."\n";
+       print OpenSRF::Utils::JSON->perl2JSON($bib)."\n";
 
        $count++;
 
index 7bccc8c..0dc9929 100755 (executable)
@@ -7,7 +7,7 @@ use lib '/openils/lib/perl5/';
 use Error qw/:try/;
 use OpenILS::Utils::Fieldmapper;
 use Digest::MD5 qw/md5_hex/;
-use JSON;
+use OpenSRF::Utils::JSON;
 use Data::Dumper;
 use Unicode::Normalize;
 use Encode;
@@ -172,7 +172,7 @@ while ( try { $rec = $batch->next } otherwise { $rec = -1 } ) {
        $bib->tcn_value($tcn_value);
        $bib->last_xact_id('IMPORT-'.$starttime);
 
-       print JSON->perl2JSON($bib)."\n";
+       print OpenSRF::Utils::JSON->perl2JSON($bib)."\n";
        $dontuse_id{$tcn_value} = 1;
 
        $count++;
index 2aeb6e2..afc1273 100755 (executable)
@@ -7,7 +7,7 @@ use OpenSRF::System;
 use OpenSRF::EX qw/:try/;
 use OpenSRF::Utils::SettingsClient;
 use OpenILS::Utils::Fieldmapper;
-use JSON;
+use OpenSRF::Utils::JSON;
 use FileHandle;
 
 use Time::HiRes qw/time/;
@@ -38,7 +38,7 @@ while ( my $rec = <> ) {
 
        my $row;
        try {
-               $row = JSON->JSON2perl($rec);
+               $row = OpenSRF::Utils::JSON->JSON2perl($rec);
        } catch Error with {
                my $e = shift;
                warn "\n\n !!! Error : $e \n\n at or around line $count\n";
index 1a532f9..73eba0c 100644 (file)
@@ -3,7 +3,7 @@
 
 use OpenSRF::AppSession;
 use OpenSRF::System;
-use JSON;
+use OpenSRF::Utils::JSON;
 use OpenILS::Utils::Fieldmapper;
 use OpenSRF::Utils::SettingsClient;
 use OpenSRF::Utils::Cache;
@@ -22,7 +22,7 @@ my $ses = OpenSRF::AppSession->create("open-ils.storage");
 my $tree = $ses->request("open-ils.storage.direct.actor.org_unit.retrieve.all.atomic")->gather(1);
 my $types = $ses->request("open-ils.storage.direct.actor.org_unit_type.retrieve.all.atomic")->gather(1);
 
-my $types_string = JSON->perl2JSON($types);
+my $types_string = OpenSRF::Utils::JSON->perl2JSON($types);
 $types_string =~ s/\"/\\\"/g;
 
 my $pile = "var _l = [";
index 192124b..d163d5d 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use strict; use warnings;
 use CGI;
-use JSON;
+use OpenSRF::Utils::JSON;
 use OpenSRF::System;
 use OpenSRF::Utils::Logger qw/$logger/;
 use OpenILS::Application::AppUtils;
@@ -226,7 +226,7 @@ sub ol_load {
 # --------------------------------------------------------------------
 sub ol_handle_result {
        my $obj = shift;
-       my $json = JSON->perl2JSON($obj);
+       my $json = OpenSRF::Utils::JSON->perl2JSON($obj);
 
        # Clear this so it's not remembered
        $evt = undef;
@@ -417,7 +417,7 @@ sub ol_file_to_perl {
        open(F, "$fname") or ol_handle_event('OFFLINE_FILE_ERROR');
        my @d = <F>;
        my @p;
-       push(@p, JSON->JSON2perl($_)) for @d;
+       push(@p, OpenSRF::Utils::JSON->JSON2perl($_)) for @d;
        close(F);
        return \@p;
 }
@@ -492,7 +492,7 @@ sub ol_append_result {
        my $obj = shift;
        my $last = shift;
 
-       $obj = JSON->perl2JSON($obj);
+       $obj = OpenSRF::Utils::JSON->perl2JSON($obj);
 
        if(!$rhandle) {
                open($rhandle, ">>$basedir/pending/$org/$seskey/results") 
index 5ae8aca..50319b4 100644 (file)
@@ -19,7 +19,7 @@ use OpenSRF::Utils qw/:datetime/;
 
 use OpenSRF::Utils::Cache;
 
-use JSON;
+use OpenSRF::Utils::JSON;
 use DateTime;
 use DateTime::Format::ISO8601;
 use OpenILS::Const qw/:const/;
@@ -63,7 +63,7 @@ sub set_user_settings {
        my @params = map { 
                [{ usr => $user->id, name => $_}, {value => $$settings{$_}}] } keys %$settings;
                
-       $_->[1]->{value} = JSON->perl2JSON($_->[1]->{value}) for @params;
+       $_->[1]->{value} = OpenSRF::Utils::JSON->perl2JSON($_->[1]->{value}) for @params;
 
        $logger->activity("User " . $staff->id . " updating user $uid settings with: " . Dumper(\@params));
 
@@ -92,7 +92,7 @@ sub set_ou_settings {
        my @params;
        for my $set (keys %$settings) {
 
-               my $json = JSON->perl2JSON($$settings{$set});
+               my $json = OpenSRF::Utils::JSON->perl2JSON($$settings{$set});
                $logger->activity("updating org_unit.setting: $ouid : $set : $json");
 
                push( @params, 
@@ -128,7 +128,7 @@ sub user_settings {
                'open-ils.cstore',
                'open-ils.cstore.direct.actor.user_setting.search.atomic', { usr => $uid } );
 
-       my $settings =  { map { ( $_->name => JSON->JSON2perl($_->value) ) } @$s };
+       my $settings =  { map { ( $_->name => OpenSRF::Utils::JSON->JSON2perl($_->value) ) } @$s };
 
    return $$settings{$setting} if $setting;
    return $settings;
@@ -149,7 +149,7 @@ sub ou_settings {
                'open-ils.cstore',
                'open-ils.cstore.direct.actor.org_unit_setting.search.atomic', {org_unit => $ouid});
 
-       return { map { ( $_->name => JSON->JSON2perl($_->value) ) } @$s };
+       return { map { ( $_->name => OpenSRF::Utils::JSON->JSON2perl($_->value) ) } @$s };
 }
 
 
@@ -293,7 +293,7 @@ sub update_patron {
        if( $opatron ) {
                # Log the new and old patron for investigation
                $logger->info("$user_session updating patron object. orig patron object = ".
-                       JSON->perl2JSON($opatron). " |||| new patron = ".JSON->perl2JSON($fuser));
+                       OpenSRF::Utils::JSON->perl2JSON($opatron). " |||| new patron = ".OpenSRF::Utils::JSON->perl2JSON($fuser));
        }
 
 
index 0ead768..65143aa 100644 (file)
@@ -1224,7 +1224,7 @@ sub ou_ancestor_setting {
 
         if( $setting ) {
             $logger->info("found org_setting $name at org $orgid : " . $setting->value);
-            return { org => $orgid, value => JSON->JSON2perl($setting->value) };
+            return { org => $orgid, value => OpenSRF::Utils::JSON->JSON2perl($setting->value) };
         }
 
         my $org = $e->retrieve_actor_org_unit($orgid) or return $e->event;
index 18fa7f0..e1d435e 100644 (file)
@@ -7,7 +7,7 @@ use OpenILS::Application::Cat::Merge;
 use base qw/OpenSRF::Application/;
 use Time::HiRes qw(time);
 use OpenSRF::EX qw(:try);
-use JSON;
+use OpenSRF::Utils::JSON;
 use OpenILS::Utils::Fieldmapper;
 use OpenILS::Event;
 use OpenILS::Const qw/:const/;
@@ -768,7 +768,7 @@ sub fleshed_copy_update {
        my $override = $self->api_name =~ /override/;
        $evt = update_fleshed_copies($editor, $override, undef, $copies, $delete_stats);
        if( $evt ) { 
-               $logger->info("fleshed copy update failed with event: ".JSON->perl2JSON($evt));
+               $logger->info("fleshed copy update failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt));
                $editor->rollback; 
                return $evt; 
        }
index 3f35826..c78cfba 100644 (file)
@@ -20,6 +20,7 @@ use strict; use warnings;
 use OpenSRF::EX qw(:try);
 use vars q/$AUTOLOAD/;
 use OpenILS::Event;
+use OpenSRF::Utils::JSON;
 use OpenSRF::Utils::Logger qw(:logger);
 use OpenILS::Utils::CStoreEditor q/:funcs/;
 use OpenSRF::Utils::SettingsClient;
@@ -350,7 +351,7 @@ sub flesh_template {
          {  name => OILS_SETTING_ORG_BOUNCED_EMAIL, 
             org_unit => $self->pickup_lib->id } )->[0] ) {
 
-      my $bemail = JSON->JSON2perl($set->value);
+      my $bemail = OpenSRF::Utils::JSON->JSON2perl($set->value);
       $sender = $bemail if $bemail;
    }
 
index 00bf712..44dc795 100644 (file)
@@ -10,7 +10,7 @@ use OpenSRF::Utils::Logger qw/:level/;
 
 use OpenILS::Utils::ScriptRunner;
 use OpenILS::Utils::Fieldmapper;
-use JSON;
+use OpenSRF::Utils::JSON;
 
 use OpenILS::Utils::Fieldmapper;
 
@@ -933,7 +933,7 @@ sub flat_marc_record {
        my @rows = $self->method_lookup("open-ils.ingest.flat_marc.$type.xml")->run($r->marc);
        for my $row (@rows) {
                $client->respond($row);
-               $log->debug(JSON->perl2JSON($row), DEBUG);
+               $log->debug(OpenSRF::Utils::JSON->perl2JSON($row), DEBUG);
        }
        return undef;
 }
@@ -1871,7 +1871,7 @@ sub extract_biblio_desc_record {
        my $r = OpenILS::Application::Ingest->storage_req( "open-ils.storage.direct.biblio.record_entry.retrieve" => $rec );
 
        my ($d) = $self->method_lookup("open-ils.worm.biblio_leader.xml")->run($r->marc);
-       $log->debug("Record descriptor for bib rec $rec is ".JSON->perl2JSON($d), DEBUG);
+       $log->debug("Record descriptor for bib rec $rec is ".OpenSRF::Utils::JSON->perl2JSON($d), DEBUG);
        return $d;
 }
 __PACKAGE__->register_method(  
index 8c0deb4..bd2bbcc 100644 (file)
@@ -1,7 +1,7 @@
 package OpenILS::Application::Search;
 use base qw/OpenSRF::Application/;
 use strict; use warnings;
-use JSON;
+use OpenSRF::Utils::JSON;
 use OpenSRF::Utils::Logger qw(:logger);
 
 use OpenILS::Utils::Fieldmapper;
@@ -34,7 +34,7 @@ sub initialize {
 
 
 # ------------------------------------------------------------------
-# Create custome dictionaries like so:
+# Create custom dictionaries like so:
 # aspell --lang=en create  master ./oils_authority.dict < /tmp/words
 # where /tmp/words is a space separated list of words
 # ------------------------------------------------------------------
index 3514172..94b5fe7 100644 (file)
@@ -9,7 +9,7 @@ use XML::LibXSLT;
 use OpenILS::Utils::Editor q/:funcs/;
 use OpenSRF::Utils::Logger qw/$logger/;
 
-use JSON;
+use OpenSRF::Utils::JSON;
 
 use Time::HiRes qw(time);
 use OpenSRF::EX qw(:try);
index ccd23a5..1262fa7 100644 (file)
@@ -3,7 +3,7 @@ use base qw/OpenSRF::Application/;
 use strict; use warnings;
 
 
-use JSON;
+use OpenSRF::Utils::JSON;
 use OpenILS::Utils::Fieldmapper;
 use OpenILS::Utils::ModsParser;
 use OpenSRF::Utils::SettingsClient;
@@ -13,7 +13,7 @@ use OpenSRF::Utils::Cache;
 use OpenSRF::Utils::Logger qw/:logger/;
 
 
-use JSON;
+use OpenSRF::Utils::JSON;
 
 use Time::HiRes qw(time);
 use OpenSRF::EX qw(:try);
@@ -478,7 +478,7 @@ sub the_quest_for_knowledge {
 
        my @search;
        push( @search, ($_ => $$searchhash{$_})) for (sort keys %$searchhash);
-       my $s = JSON->perl2JSON(\@search);
+       my $s = OpenSRF::Utils::JSON->perl2JSON(\@search);
        my $ckey = $pfx . md5_hex($method . $s);
 
        $logger->info("bib search for: $s");
@@ -526,7 +526,7 @@ sub the_quest_for_knowledge {
                }
                @recs = @t;
 
-               #$logger->debug("cache done .. returning $offset..$end : " . JSON->perl2JSON(\@recs));
+               #$logger->debug("cache done .. returning $offset..$end : " . OpenSRF::Utils::JSON->perl2JSON(\@recs));
        }
 
        return { ids => \@recs, count => $count };
@@ -654,7 +654,7 @@ sub biblio_mrid_to_modsbatch {
 # converts a metarecord to an mvr
 sub _mr_to_mvr {
        my $mr = shift;
-       my $perl = JSON->JSON2perl($mr->mods());
+       my $perl = OpenSRF::Utils::JSON->JSON2perl($mr->mods());
        return Fieldmapper::metabib::virtual_record->new($perl);
 }
 
@@ -755,7 +755,7 @@ sub biblio_mrid_make_modsbatch {
 
 
        # now update the mods string in the db
-       my $string = JSON->perl2JSON($mods->decast);
+       my $string = OpenSRF::Utils::JSON->perl2JSON($mods->decast);
        $mr->mods($string);
 
        #$e = OpenILS::Utils::Editor->new(xact => 1);
@@ -1035,7 +1035,7 @@ sub marc_search {
 
        my @search;
        push( @search, ($_ => $$args{$_}) ) for (sort keys %$args);
-       my $ckey = $pfx . md5_hex($method . JSON->perl2JSON(\@search));
+       my $ckey = $pfx . md5_hex($method . OpenSRF::Utils::JSON->perl2JSON(\@search));
 
        my $recs = search_cache($ckey, $offset, $limit);
 
index 8603475..a3df1aa 100644 (file)
@@ -14,7 +14,7 @@ use OpenILS::Application::Storage::CDBI::money;
 use OpenILS::Application::Storage::CDBI::permission;
 use OpenILS::Application::Storage::CDBI::container;
 
-use JSON;
+use OpenSRF::Utils::JSON;
 use OpenSRF::Utils::Logger qw(:level);
 use OpenSRF::EX qw/:try/;
 
@@ -237,7 +237,7 @@ sub create {
        my $self = shift;
        my $arg = shift;
 
-       $log->debug("CDBI->create: \$arg is $arg (".ref($arg)." : ".JSON->perl2JSON($arg).")",DEBUG);
+       $log->debug("CDBI->create: \$arg is $arg (".ref($arg)." : ".OpenSRF::Utils::JSON->perl2JSON($arg).")",DEBUG);
 
        if (ref($arg) && UNIVERSAL::isa($arg => 'Fieldmapper')) {
                return $self->create_from_fieldmapper($arg,@_);
index b5c6dc6..04c71ba 100644 (file)
@@ -4,7 +4,7 @@ use base qw/OpenILS::Application::Storage/;
 #use OpenILS::Utils::Fieldmapper;
 use OpenSRF::Utils::Logger qw/:level/;
 use OpenSRF::EX qw/:try/;
-use JSON;
+use OpenSRF::Utils::JSON;
 
 #
 
@@ -101,7 +101,7 @@ sub import_xml_holdings {
                        $org_cache{ $f->subfield( $map->{owning_lib} ) } = $ol;
                } otherwise {
                        $log->debug('Could not find library with shortname ['.$f->subfield( $map->{owning_lib} ).'] : '. shift(), ERROR);
-                       $log->info('Failed holdings tag: ['.JSON->perl2JSON( $f ).']');
+                       $log->info('Failed holdings tag: ['.OpenSRF::Utils::JSON->perl2JSON( $f ).']');
                };
                
                try {
@@ -112,7 +112,7 @@ sub import_xml_holdings {
                        $org_cache{ $f->subfield( $map->{circulating_lib} ) } = $cl;
                } otherwise {
                        $log->debug('Could not find library with shortname ['.$f->subfield( $map->{circulating_lib} ).'] : '. shift(), ERROR);
-                       $log->info('Failed holdings tag: ['.JSON->perl2JSON( $f ).']');
+                       $log->info('Failed holdings tag: ['.OpenSRF::Utils::JSON->perl2JSON( $f ).']');
                };
 
                next unless ($ol && $cl);
@@ -129,7 +129,7 @@ sub import_xml_holdings {
                        );
                } otherwise {
                        $log->debug('Could not find or create callnumber ['.$f->subfield( $map->{call_number} )."] on record $record : ". shift(), ERROR);
-                       $log->info('Failed holdings tag: ['.JSON->perl2JSON( $f ).']');
+                       $log->info('Failed holdings tag: ['.OpenSRF::Utils::JSON->perl2JSON( $f ).']');
                };
 
                next unless ($cn);
index 4bb8624..a85d90e 100644 (file)
@@ -11,7 +11,7 @@ my $log = 'OpenSRF::Utils::Logger';
 
 use OpenILS::Utils::FlatXML;
 use OpenILS::Utils::Fieldmapper;
-use JSON;
+use OpenSRF::Utils::JSON;
 
 use XML::LibXML;
 use XML::LibXSLT;
index 916a23b..978e946 100644 (file)
@@ -29,7 +29,7 @@ use XML::LibXML;
 use XML::LibXSLT;
 use Unicode::Normalize;
 
-use JSON;
+use OpenSRF::Utils::JSON;
 
 our (
   $_parser,
index 1402b3e..c0432b2 100644 (file)
@@ -10,7 +10,7 @@ use OpenSRF::Utils::Logger qw/:level/;
 
 use OpenILS::Utils::FlatXML;
 use OpenILS::Utils::Fieldmapper;
-use JSON;
+use OpenSRF::Utils::JSON;
 
 use OpenILS::Utils::Fieldmapper;
 
@@ -881,7 +881,7 @@ sub extract_biblio_desc_record {
        my $r = OpenILS::Application::WoRM->storage_req( "open-ils.storage.direct.biblio.record_entry.retrieve" => $rec );
 
        my ($d) = $self->method_lookup("open-ils.worm.biblio_leader.xml")->run($r->marc);
-       $log->debug("Record descriptor for bib rec $rec is ".JSON->perl2JSON($d), DEBUG);
+       $log->debug("Record descriptor for bib rec $rec is ".OpenSRF::Utils::JSON->perl2JSON($d), DEBUG);
        return $d;
 }
 __PACKAGE__->register_method(  
index d2ada4e..9376723 100644 (file)
@@ -69,7 +69,7 @@ sub do_checkout {
 
        my $key;
 
-       syslog('LOG_DEBUG', "OILS: Checkout permit returned event: " . JSON->perl2JSON($resp));
+       syslog('LOG_DEBUG', "OILS: Checkout permit returned event: " . OpenSRF::Utils::JSON->perl2JSON($resp));
 
        if( @$resp == 1 and ! $U->event_code($$resp[0]) ) {
                $key = $$resp[0]->{payload};
@@ -111,7 +111,7 @@ sub do_checkout {
                'open-ils.circ.checkout', $self->{authtoken}, $args );
 
 
-       syslog('LOG_DEBUG', "OILS: Checkout returned event: " . JSON->perl2JSON($resp));
+       syslog('LOG_DEBUG', "OILS: Checkout returned event: " . OpenSRF::Utils::JSON->perl2JSON($resp));
 
        # XXX Check for events
        if( $resp ) {
index 84c45cb..050aee2 100644 (file)
@@ -8,7 +8,7 @@ use OpenSRF::AppSession;
 use OpenSRF::System;
 use XML::LibXML;
 use OpenSRF::Utils::SettingsParser;
-use JSON;
+use OpenSRF::Utils::JSON;
 
 sub new {
        my ($class) = @_;
@@ -26,7 +26,7 @@ sub XML2perl {
 
 sub perl2JSON {
        my( $self, $perl ) = @_;
-       my $json = JSON->perl2JSON($perl);
+       my $json = OpenSRF::Utils::JSON->perl2JSON($perl);
        warn "Created JSON from perl:\n$json\n";
        return $json;
 }
@@ -34,14 +34,14 @@ sub perl2JSON {
 sub JSON2perl {
        my( $self, $perl ) = @_;
        warn "Turning JSON into perl:\n$perl\n";
-       my $obj = JSON->JSON2perl($perl);
+       my $obj = OpenSRF::Utils::JSON->JSON2perl($perl);
        warn "Created Perl from JSON: $obj \n";
        return $obj;
 }
 
 sub perl2prettyJSON {
        my( $self, $perl ) = @_;
-       return JSON->perl2prettyJSON($perl);
+       return OpenSRF::Utils::JSON->perl2prettyJSON($perl);
 }
 
 
index fa4a142..cb53d1e 100644 (file)
@@ -6,7 +6,7 @@ use OpenSRF::EX qw(:try);
 use OpenILS::Utils::Fieldmapper;
 use OpenILS::Event;
 use Data::Dumper;
-use JSON;
+use OpenSRF::Utils::JSON;
 use OpenSRF::Utils::Logger qw($logger);
 my $U = "OpenILS::Application::AppUtils";
 my %PERMS;
@@ -422,7 +422,7 @@ sub __arg_to_string {
        if( UNIVERSAL::isa($arg, "Fieldmapper") ) {
                return (defined $arg->id) ? $arg->id : '<new object>';
        }
-       return JSON->perl2JSON($arg);
+       return OpenSRF::Utils::JSON->perl2JSON($arg);
        return "";
 }
 
index 42980e5..0a674a7 100644 (file)
@@ -6,7 +6,7 @@ use OpenSRF::EX qw(:try);
 use OpenILS::Utils::Fieldmapper;
 use OpenILS::Event;
 use Data::Dumper;
-use JSON;
+use OpenSRF::Utils::JSON;
 use OpenSRF::Utils::Logger qw($logger);
 my $U = "OpenILS::Application::AppUtils";
 
@@ -337,7 +337,7 @@ sub __arg_to_string {
        my $arg = shift;
        return "" unless defined $arg;
        return $arg->id if UNIVERSAL::isa($arg, "Fieldmapper");
-       return JSON->perl2JSON($arg);
+       return OpenSRF::Utils::JSON->perl2JSON($arg);
 }
 
 
index 8aece95..d8a05dd 100644 (file)
@@ -1,5 +1,5 @@
 package Fieldmapper;
-use JSON;
+use OpenSRF::Utils::JSON;
 use Data::Dumper;
 use base 'OpenSRF::Application';
 use OpenSRF::Utils::Logger;
@@ -97,7 +97,7 @@ sub import {
                        }
                }
 
-               JSON->register_class_hint(
+               OpenSRF::Utils::JSON->register_class_hint(
                        hint => $pkg->json_hint,
                        name => $pkg,
                        type => 'array',
index c09a0e7..42353d2 100644 (file)
@@ -2,7 +2,7 @@ package OpenILS::Utils::ScriptRunner;
 use strict; use warnings;
 use OpenSRF::Utils::Logger qw(:logger);
 use OpenSRF::EX qw(:try);
-use JSON;
+use OpenSRF::Utils::JSON;
 use JavaScript::SpiderMonkey;
 use LWP::UserAgent;
 use XML::LibXML;
@@ -183,7 +183,7 @@ sub run {
 
        close(F);
        $logger->debug( "script result is [$res]" );
-       return JSON->JSON2perl( $res );
+       return OpenSRF::Utils::JSON->JSON2perl( $res );
 }
 
 sub remove_path { 
@@ -469,7 +469,7 @@ sub _jsonopensrfrequest_send {
        my $blocking = shift;
        my $params = shift;
 
-       my @p = @{ JSON->JSON2perl($params) };
+       my @p = @{ OpenSRF::Utils::JSON->JSON2perl($params) };
 
        my $ctx = $self->context;
 
@@ -484,7 +484,7 @@ sub _jsonopensrfrequest_send {
        if (!$req->failed) {
                my $res = $req->recv->content;
                
-               $ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.responseText', JSON->perl2JSON($res));
+               $ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.responseText', OpenSRF::Utils::JSON->perl2JSON($res));
                $ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.readyState', 4);
                $ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.statusText', 'OK');
                $ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.status', '200');
index 80a294a..38f9bfd 100644 (file)
@@ -3,7 +3,7 @@ use strict; use warnings;
 use LWP::UserAgent;
 use OpenSRF::Utils::Logger qw/$logger/;
 use OpenSRF::Utils::SettingsParser;
-use JSON;
+use OpenSRF::Utils::JSON;
 use OpenSRF::EX qw/:try/;
 use OpenILS::WWW::AddedContent;
 
@@ -184,7 +184,7 @@ sub send_json {
 
        return 0 unless $doc;
        my $perl = OpenSRF::Utils::SettingsParser::XML2perl($doc->documentElement);
-       my $json = JSON->perl2JSON($perl);
+       my $json = OpenSRF::Utils::JSON->perl2JSON($perl);
        print "Content-type: text/plain\n\n";
        print $json;
        return 1;
index ab8f9c8..9321b33 100644 (file)
@@ -9,7 +9,7 @@ use Apache2::RequestRec ();
 use Apache2::RequestIO ();
 use Apache2::RequestUtil;
 
-use JSON;
+use OpenSRF::Utils::JSON;
 
 use CGI ();
 
@@ -47,7 +47,7 @@ sub handler {
        }
 
        if($err) {
-               print  JSON->perl2JSON($err);
+               print  OpenSRF::Utils::JSON->perl2JSON($err);
                return Apache2::Const::OK;
        }
 
@@ -58,11 +58,11 @@ sub handler {
 
        if(defined($cgi->param("param"))) {
                for my $param ( $cgi->param("param")) {
-                       push( @param_array, JSON->JSON2perl( $param ));
+                       push( @param_array, OpenSRF::Utils::JSON->JSON2perl( $param ));
                }
        } else {
                for my $param ($cgi->param()) {
-                       $param_hash{$param} = JSON->JSON2perl($cgi->param($param))
+                       $param_hash{$param} = OpenSRF::Utils::JSON->JSON2perl($cgi->param($param))
                                unless( $param eq "method" or $param eq "service" );
                }
        }
@@ -122,7 +122,7 @@ sub perform_method {
                                        "Service: $service \nMethod: $method \nParams: @params \n" .
                                        $response->stringify() . "\n",
                        };
-                       print JSON->perl2JSON($err);
+                       print OpenSRF::Utils::JSON->perl2JSON($err);
                        $request->finish();
                        return 0;
                }
@@ -140,7 +140,7 @@ sub perform_method {
                                "Service: $service \nMethod: $method \nParams: @params \n" .
                                "request->complete test failed in OpenILS::Web::Method\n" 
                };
-               print JSON->perl2JSON($err); 
+               print OpenSRF::Utils::JSON->perl2JSON($err); 
                $request->finish();
                return 0;
        }
@@ -151,7 +151,7 @@ sub perform_method {
        warn "Results: \n";
        warn Dumper \@results;
 
-       print JSON->perl2JSON( \@results );
+       print OpenSRF::Utils::JSON->perl2JSON( \@results );
 
        return 1;
 }
index 82808ca..047a2ef 100755 (executable)
@@ -8,12 +8,12 @@ use XML::LibXML;
 use Getopt::Long;
 use DateTime;
 use DateTime::Format::ISO8601;
-use JSON;
 use Data::Dumper;
 use Text::CSV_XS;
 use Spreadsheet::WriteExcel::Big;
 use OpenSRF::EX qw/:try/;
 use OpenSRF::Utils qw/:daemon/;
+use OpenSRF::Utils::JSON;
 #use OpenSRF::Utils::Logger qw/:level/;
 use OpenSRF::System;
 use OpenSRF::AppSession;
@@ -129,9 +129,9 @@ while (my $r = $sth->fetchrow_hashref) {
        $r->{report} = $s3;
 
        my $b = OpenILS::Reporter::SQLBuilder->new;
-       $b->register_params( JSON->JSON2perl( $r->{report}->{data} ) );
+       $b->register_params( OpenSRF::Utils::JSON->JSON2perl( $r->{report}->{data} ) );
 
-       $r->{resultset} = $b->parse_report( JSON->JSON2perl( $r->{report}->{template}->{data} ) );
+       $r->{resultset} = $b->parse_report( OpenSRF::Utils::JSON->JSON2perl( $r->{report}->{template}->{data} ) );
        $r->{resultset}->relative_time($r->{run_time});
        push @reports, $r;
 }
index 268e91a..9e04a78 100755 (executable)
@@ -7,7 +7,7 @@
 
 use strict; 
 use warnings;
-use JSON;
+use OpenSRF::Utils::JSON;
 use OpenSRF::System;
 
 my $config = shift || die "bootstrap config required\n";
index 3f592c9..bef9f5b 100755 (executable)
@@ -6,7 +6,7 @@
 
 use strict; 
 use warnings;
-use JSON;
+use OpenSRF::Utils::JSON;
 use OpenSRF::System;
 
 my $config = shift || die "bootstrap config required\n";
index 9a6baf8..ff2b3c9 100755 (executable)
@@ -6,6 +6,7 @@ use bytes;
 use OpenSRF::System;
 use OpenSRF::EX qw/:try/;
 use OpenSRF::AppSession;
+use OpenSRF::Utils::JSON;
 use OpenSRF::Utils::SettingsClient;
 use OpenILS::Application::AppUtils;
 use OpenILS::Utils::Fieldmapper;
@@ -138,7 +139,7 @@ while ( my $i = <> ) {
        next unless $bib;
 
     if (uc($format) eq 'BRE') {
-        print JSON->perl2JSON($bib);
+        print OpenSRF::Utils::JSON->perl2JSON($bib);
            stats();
         next;
     }
index d17f9f4..2506fd6 100755 (executable)
@@ -6,7 +6,7 @@
 
 use strict;
 use warnings;
-use JSON;
+use OpenSRF::Utils::JSON;
 use Data::Dumper;
 use OpenSRF::System;
 use OpenSRF::AppSession;
index a518662..5e071b9 100755 (executable)
@@ -4,7 +4,7 @@ use vars qw/ $user $authtoken /;
 use strict; use warnings;
 use Time::HiRes qw/time/;
 use Data::Dumper;
-use JSON;
+use OpenSRF::Utils::JSON;
 
 #-----------------------------------------------------------------------------
 # Does a checkout, renew, and checkin 
index 3262d8b..80c2dd1 100755 (executable)
@@ -6,7 +6,7 @@ use Time::HiRes qw/time usleep/;
 use LWP::UserAgent;
 use HTTP::Request::Common;
 use Data::Dumper;
-use JSON;
+use OpenSRF::Utils::JSON;
 
 #-----------------------------------------------------------------------------
 # Does a checkout, renew, and checkin 
@@ -81,9 +81,9 @@ sub build_script {
                        backdate                        => $t1
                };
        
-               $json .= JSON->perl2JSON($checkout) . "\n";
-               $json .= JSON->perl2JSON($renew) . "\n" if $renew;
-               $json .= JSON->perl2JSON($checkin) . "\n";
+               $json .= OpenSRF::Utils::JSON->perl2JSON($checkout) . "\n";
+               $json .= OpenSRF::Utils::JSON->perl2JSON($renew) . "\n" if $renew;
+               $json .= OpenSRF::Utils::JSON->perl2JSON($checkin) . "\n";
        }
 
        return $json;
@@ -106,7 +106,7 @@ sub create_session {
        my $url = "$baseurl/offline.pl$params&action=create&desc=test_d";
        my $req = GET( $url );
        my $res = $useragent->request($req);
-       my $response = JSON->JSON2perl($res->{_content});
+       my $response = OpenSRF::Utils::JSON->JSON2perl($res->{_content});
 
        oils_event_die($response);
        $seskey = $response->{payload};
@@ -136,7 +136,7 @@ sub upload_script {
        my $res = $useragent->request($req);
 
        # Pass request to the user agent and get a response back
-       my $event = JSON->JSON2perl($res->{_content});
+       my $event = OpenSRF::Utils::JSON->JSON2perl($res->{_content});
        oils_event_die($event);
        print "Upload succeeded to session $seskey...\n";
 }
@@ -151,7 +151,7 @@ sub check_sessions {
        my $url = "$baseurl/offline.pl$params&action=status&status_type=scripts";
        my $req = GET( $url );
        my $res = $useragent->request($req);
-       my $ses = JSON->JSON2perl($res->{_content});
+       my $ses = OpenSRF::Utils::JSON->JSON2perl($res->{_content});
 
        my $scripts = $ses->{scripts};
        delete $ses->{scripts};
@@ -184,7 +184,7 @@ sub run_script {
        my $req = GET( $url );
 
        my $res = $useragent->request($req);
-       my $event = JSON->JSON2perl($res->{_content});
+       my $event = OpenSRF::Utils::JSON->JSON2perl($res->{_content});
 
        oils_event_die($event);
 }
@@ -199,7 +199,7 @@ sub check_script {
                my $url = "$baseurl/offline.pl$params&action=status&status_type=summary";
                my $req = GET( $url );
                my $res = $useragent->request($req);
-               my $blob = JSON->JSON2perl($res->{_content});
+               my $blob = OpenSRF::Utils::JSON->JSON2perl($res->{_content});
 
                my $total = $blob->{total};
                my $count = $blob->{num_complete} || "0";
@@ -216,7 +216,7 @@ sub check_script {
        my $url = "$baseurl/offline.pl$params&action=status&status_type=exceptions";
        my $req = GET( $url );
        my $res = $useragent->request($req);
-       my $blob = JSON->JSON2perl($res->{_content});
+       my $blob = OpenSRF::Utils::JSON->JSON2perl($res->{_content});
 
        my @events;
        push(@events, $_->{event}) for @$blob;