From 88db904cbb9b348a20bc50e33292cb913fc2df5f Mon Sep 17 00:00:00 2001 From: miker Date: Mon, 2 Jul 2007 15:11:35 +0000 Subject: [PATCH] Patch from Dan Scott to move JSON to OpenSRF::Utils::JSON: 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 --- Evergreen/src/extras/import/object_dumper.pl | 4 ++-- Evergreen/src/extras/import/parse_patron_xml.pl | 4 ++-- Evergreen/src/support-scripts/eg_gen_overdue.pl | 3 ++- Open-ILS/examples/json-request-test.pl | 6 +++--- Open-ILS/examples/reporter-sql-builder-test.pl | 6 +++--- Open-ILS/src/extras/Perl2REST.pl | 2 +- Open-ILS/src/extras/import/direct_ingest.pl | 12 ++++++------ Open-ILS/src/extras/import/direct_loader.pl | 4 ++-- Open-ILS/src/extras/import/marc2are.pl | 4 ++-- Open-ILS/src/extras/import/marc2bre.pl | 4 ++-- Open-ILS/src/extras/import/pg_loader.pl | 4 ++-- Open-ILS/src/extras/org_tree_js.pl | 4 ++-- Open-ILS/src/offline/offline.pl | 8 ++++---- Open-ILS/src/perlmods/OpenILS/Application/Actor.pm | 12 ++++++------ .../src/perlmods/OpenILS/Application/AppUtils.pm | 2 +- Open-ILS/src/perlmods/OpenILS/Application/Cat.pm | 4 ++-- .../perlmods/OpenILS/Application/Circ/HoldNotify.pm | 3 ++- Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm | 6 +++--- Open-ILS/src/perlmods/OpenILS/Application/Search.pm | 4 ++-- .../perlmods/OpenILS/Application/Search/Authority.pm | 2 +- .../perlmods/OpenILS/Application/Search/Biblio.pm | 14 +++++++------- .../src/perlmods/OpenILS/Application/Storage/CDBI.pm | 4 ++-- .../OpenILS/Application/Storage/Publisher/asset.pm | 8 ++++---- .../src/perlmods/OpenILS/Application/Storage/WORM.pm | 2 +- .../src/perlmods/OpenILS/Application/SuperCat.pm | 2 +- Open-ILS/src/perlmods/OpenILS/Application/WoRM.pm | 4 ++-- .../src/perlmods/OpenILS/SIP/Transaction/Checkout.pm | 4 ++-- .../src/perlmods/OpenILS/Template/Plugin/WebUtils.pm | 8 ++++---- Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm | 4 ++-- Open-ILS/src/perlmods/OpenILS/Utils/Editor.pm | 4 ++-- Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm | 4 ++-- Open-ILS/src/perlmods/OpenILS/Utils/ScriptRunner.pm | 8 ++++---- .../perlmods/OpenILS/WWW/AddedContent/Syndetic.pm | 4 ++-- Open-ILS/src/perlmods/OpenILS/WWW/Method.pm | 14 +++++++------- Open-ILS/src/reporter/clark-kent.pl | 6 +++--- Open-ILS/src/support-scripts/fine_generator.pl | 2 +- Open-ILS/src/support-scripts/hold_targeter.pl | 2 +- Open-ILS/src/support-scripts/marc_export | 3 ++- Open-ILS/src/support-scripts/oils_header.pl | 2 +- Open-ILS/src/support-scripts/test-scripts/notes.pl | 2 +- Open-ILS/src/support-scripts/test-scripts/offline.pl | 20 ++++++++++---------- 41 files changed, 111 insertions(+), 108 deletions(-) diff --git a/Evergreen/src/extras/import/object_dumper.pl b/Evergreen/src/extras/import/object_dumper.pl index de7f33df5b..0f69ca42f8 100755 --- a/Evergreen/src/extras/import/object_dumper.pl +++ b/Evergreen/src/extras/import/object_dumper.pl @@ -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; } diff --git a/Evergreen/src/extras/import/parse_patron_xml.pl b/Evergreen/src/extras/import/parse_patron_xml.pl index 0608c85e0d..8e580a2fcb 100755 --- a/Evergreen/src/extras/import/parse_patron_xml.pl +++ b/Evergreen/src/extras/import/parse_patron_xml.pl @@ -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++; } diff --git a/Evergreen/src/support-scripts/eg_gen_overdue.pl b/Evergreen/src/support-scripts/eg_gen_overdue.pl index 6580dab0eb..d50349485d 100755 --- a/Evergreen/src/support-scripts/eg_gen_overdue.pl +++ b/Evergreen/src/support-scripts/eg_gen_overdue.pl @@ -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; } diff --git a/Open-ILS/examples/json-request-test.pl b/Open-ILS/examples/json-request-test.pl index 4ee7935e4a..c75877e326 100755 --- a/Open-ILS/examples/json-request-test.pl +++ b/Open-ILS/examples/json-request-test.pl @@ -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(); diff --git a/Open-ILS/examples/reporter-sql-builder-test.pl b/Open-ILS/examples/reporter-sql-builder-test.pl index b7ebb9117e..d5a1a1f232 100755 --- a/Open-ILS/examples/reporter-sql-builder-test.pl +++ b/Open-ILS/examples/reporter-sql-builder-test.pl @@ -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; diff --git a/Open-ILS/src/extras/Perl2REST.pl b/Open-ILS/src/extras/Perl2REST.pl index 6a128f750f..5eb8fe0253 100755 --- a/Open-ILS/src/extras/Perl2REST.pl +++ b/Open-ILS/src/extras/Perl2REST.pl @@ -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; diff --git a/Open-ILS/src/extras/import/direct_ingest.pl b/Open-ILS/src/extras/import/direct_ingest.pl index a5f3c1e6d7..48060c6cd2 100755 --- a/Open-ILS/src/extras/import/direct_ingest.pl +++ b/Open-ILS/src/extras/import/direct_ingest.pl @@ -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); } diff --git a/Open-ILS/src/extras/import/direct_loader.pl b/Open-ILS/src/extras/import/direct_loader.pl index ea5c7f2c42..45f7a5637b 100755 --- a/Open-ILS/src/extras/import/direct_loader.pl +++ b/Open-ILS/src/extras/import/direct_loader.pl @@ -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); diff --git a/Open-ILS/src/extras/import/marc2are.pl b/Open-ILS/src/extras/import/marc2are.pl index 3391bc4d1d..652a6a64e7 100755 --- a/Open-ILS/src/extras/import/marc2are.pl +++ b/Open-ILS/src/extras/import/marc2are.pl @@ -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++; diff --git a/Open-ILS/src/extras/import/marc2bre.pl b/Open-ILS/src/extras/import/marc2bre.pl index 7bccc8c2fa..0dc99297d5 100755 --- a/Open-ILS/src/extras/import/marc2bre.pl +++ b/Open-ILS/src/extras/import/marc2bre.pl @@ -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++; diff --git a/Open-ILS/src/extras/import/pg_loader.pl b/Open-ILS/src/extras/import/pg_loader.pl index 2aeb6e2afb..afc12738bb 100755 --- a/Open-ILS/src/extras/import/pg_loader.pl +++ b/Open-ILS/src/extras/import/pg_loader.pl @@ -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"; diff --git a/Open-ILS/src/extras/org_tree_js.pl b/Open-ILS/src/extras/org_tree_js.pl index 1a532f9ef4..73eba0cdd7 100644 --- a/Open-ILS/src/extras/org_tree_js.pl +++ b/Open-ILS/src/extras/org_tree_js.pl @@ -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 = ["; diff --git a/Open-ILS/src/offline/offline.pl b/Open-ILS/src/offline/offline.pl index 192124b438..d163d5d65b 100755 --- a/Open-ILS/src/offline/offline.pl +++ b/Open-ILS/src/offline/offline.pl @@ -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 = ; 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") diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm index 5ae8aca4ba..50319b46ad 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm @@ -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)); } diff --git a/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm b/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm index 0ead768620..65143aa659 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm @@ -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; diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm b/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm index 18fa7f0daf..e1d435e4bc 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Cat.pm @@ -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; } diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/HoldNotify.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/HoldNotify.pm index 3f35826fbb..c78cfbaff7 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/HoldNotify.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/HoldNotify.pm @@ -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; } diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm b/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm index 00bf712241..44dc795d5e 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm @@ -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( diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search.pm index 8c0deb4408..bd2bbcc0eb 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Search.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Search.pm @@ -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 # ------------------------------------------------------------------ diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Authority.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Authority.pm index 3514172850..94b5fe7eb0 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Authority.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Authority.pm @@ -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); diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm index ccd23a5dca..1262fa7a32 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm @@ -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); diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm index 8603475128..a3df1aadf8 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm @@ -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,@_); diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm index b5c6dc6db0..04c71ba772 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/asset.pm @@ -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); diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/WORM.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/WORM.pm index 4bb8624c75..a85d90ea61 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/WORM.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/WORM.pm @@ -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; diff --git a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm index 916a23b5f3..978e946ecb 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm @@ -29,7 +29,7 @@ use XML::LibXML; use XML::LibXSLT; use Unicode::Normalize; -use JSON; +use OpenSRF::Utils::JSON; our ( $_parser, diff --git a/Open-ILS/src/perlmods/OpenILS/Application/WoRM.pm b/Open-ILS/src/perlmods/OpenILS/Application/WoRM.pm index 1402b3e28a..c0432b20b2 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/WoRM.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/WoRM.pm @@ -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( diff --git a/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkout.pm b/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkout.pm index d2ada4efb0..93767236e5 100644 --- a/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkout.pm +++ b/Open-ILS/src/perlmods/OpenILS/SIP/Transaction/Checkout.pm @@ -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 ) { diff --git a/Open-ILS/src/perlmods/OpenILS/Template/Plugin/WebUtils.pm b/Open-ILS/src/perlmods/OpenILS/Template/Plugin/WebUtils.pm index 84c45cb386..050aee2b4a 100644 --- a/Open-ILS/src/perlmods/OpenILS/Template/Plugin/WebUtils.pm +++ b/Open-ILS/src/perlmods/OpenILS/Template/Plugin/WebUtils.pm @@ -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); } diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm b/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm index fa4a142464..cb53d1e3fd 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/CStoreEditor.pm @@ -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 : ''; } - return JSON->perl2JSON($arg); + return OpenSRF::Utils::JSON->perl2JSON($arg); return ""; } diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/Editor.pm b/Open-ILS/src/perlmods/OpenILS/Utils/Editor.pm index 42980e5f70..0a674a7331 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/Editor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/Editor.pm @@ -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); } diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm b/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm index 8aece95227..d8a05dd70d 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/Fieldmapper.pm @@ -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', diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/ScriptRunner.pm b/Open-ILS/src/perlmods/OpenILS/Utils/ScriptRunner.pm index c09a0e792e..42353d2b7b 100644 --- a/Open-ILS/src/perlmods/OpenILS/Utils/ScriptRunner.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/ScriptRunner.pm @@ -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'); diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/AddedContent/Syndetic.pm b/Open-ILS/src/perlmods/OpenILS/WWW/AddedContent/Syndetic.pm index 80a294a9e6..38f9bfd4df 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/AddedContent/Syndetic.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/AddedContent/Syndetic.pm @@ -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; diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/Method.pm b/Open-ILS/src/perlmods/OpenILS/WWW/Method.pm index ab8f9c8a4e..9321b337a0 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/Method.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/Method.pm @@ -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; } diff --git a/Open-ILS/src/reporter/clark-kent.pl b/Open-ILS/src/reporter/clark-kent.pl index 82808cadec..047a2ef448 100755 --- a/Open-ILS/src/reporter/clark-kent.pl +++ b/Open-ILS/src/reporter/clark-kent.pl @@ -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; } diff --git a/Open-ILS/src/support-scripts/fine_generator.pl b/Open-ILS/src/support-scripts/fine_generator.pl index 268e91a171..9e04a7820c 100755 --- a/Open-ILS/src/support-scripts/fine_generator.pl +++ b/Open-ILS/src/support-scripts/fine_generator.pl @@ -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"; diff --git a/Open-ILS/src/support-scripts/hold_targeter.pl b/Open-ILS/src/support-scripts/hold_targeter.pl index 3f592c9cc3..bef9f5b722 100755 --- a/Open-ILS/src/support-scripts/hold_targeter.pl +++ b/Open-ILS/src/support-scripts/hold_targeter.pl @@ -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"; diff --git a/Open-ILS/src/support-scripts/marc_export b/Open-ILS/src/support-scripts/marc_export index 9a6baf8c34..ff2b3c9f42 100755 --- a/Open-ILS/src/support-scripts/marc_export +++ b/Open-ILS/src/support-scripts/marc_export @@ -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; } diff --git a/Open-ILS/src/support-scripts/oils_header.pl b/Open-ILS/src/support-scripts/oils_header.pl index d17f9f4de3..2506fd68e6 100755 --- a/Open-ILS/src/support-scripts/oils_header.pl +++ b/Open-ILS/src/support-scripts/oils_header.pl @@ -6,7 +6,7 @@ use strict; use warnings; -use JSON; +use OpenSRF::Utils::JSON; use Data::Dumper; use OpenSRF::System; use OpenSRF::AppSession; diff --git a/Open-ILS/src/support-scripts/test-scripts/notes.pl b/Open-ILS/src/support-scripts/test-scripts/notes.pl index a518662c8a..5e071b9a83 100755 --- a/Open-ILS/src/support-scripts/test-scripts/notes.pl +++ b/Open-ILS/src/support-scripts/test-scripts/notes.pl @@ -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 diff --git a/Open-ILS/src/support-scripts/test-scripts/offline.pl b/Open-ILS/src/support-scripts/test-scripts/offline.pl index 3262d8b773..80c2dd1d18 100755 --- a/Open-ILS/src/support-scripts/test-scripts/offline.pl +++ b/Open-ILS/src/support-scripts/test-scripts/offline.pl @@ -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; -- 2.11.0