use strict;
use warnings;
-use JSON;
+use OpenSRF::Utils::JSON;
use OpenSRF::System;
use OpenILS::Utils::Fieldmapper;
use OpenSRF::Utils::SettingsClient;
$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;
}
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;
}
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++;
}
use Email::Send;
use DateTime::Format::ISO8601;
use OpenSRF::Utils qw/:datetime/;
+use OpenSRF::Utils::JSON;
use Unicode::Normalize;
use OpenILS::Const qw/:const/;
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;
}
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;
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();
use warnings;
use strict;
use OpenILS::Reporter::SQLBuilder;
-use JSON;
+use OpenSRF::Utils::JSON;
my $report = {
select => [
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 ],
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;
#!/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;
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;
while (my $rec = <>) {
next unless ($rec);
- my $bib = JSON->JSON2perl($rec);
+ my $bib = OpenSRF::Utils::JSON->JSON2perl($rec);
my $data;
try {
$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);
}
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;
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);
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;
$bib->arn_value($count);
$bib->last_xact_id('IMPORT-'.$starttime);
- print JSON->perl2JSON($bib)."\n";
+ print OpenSRF::Utils::JSON->perl2JSON($bib)."\n";
$count++;
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;
$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++;
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/;
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";
use OpenSRF::AppSession;
use OpenSRF::System;
-use JSON;
+use OpenSRF::Utils::JSON;
use OpenILS::Utils::Fieldmapper;
use OpenSRF::Utils::SettingsClient;
use OpenSRF::Utils::Cache;
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 = [";
#!/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;
# --------------------------------------------------------------------
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;
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;
}
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")
use OpenSRF::Utils::Cache;
-use JSON;
+use OpenSRF::Utils::JSON;
use DateTime;
use DateTime::Format::ISO8601;
use OpenILS::Const qw/:const/;
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));
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,
'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;
'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 };
}
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));
}
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;
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/;
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;
}
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;
{ 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;
}
use OpenILS::Utils::ScriptRunner;
use OpenILS::Utils::Fieldmapper;
-use JSON;
+use OpenSRF::Utils::JSON;
use OpenILS::Utils::Fieldmapper;
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;
}
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(
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;
# ------------------------------------------------------------------
-# 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
# ------------------------------------------------------------------
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);
use strict; use warnings;
-use JSON;
+use OpenSRF::Utils::JSON;
use OpenILS::Utils::Fieldmapper;
use OpenILS::Utils::ModsParser;
use OpenSRF::Utils::SettingsClient;
use OpenSRF::Utils::Logger qw/:logger/;
-use JSON;
+use OpenSRF::Utils::JSON;
use Time::HiRes qw(time);
use OpenSRF::EX qw(:try);
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");
}
@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 };
# 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);
}
# 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);
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);
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/;
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,@_);
#use OpenILS::Utils::Fieldmapper;
use OpenSRF::Utils::Logger qw/:level/;
use OpenSRF::EX qw/:try/;
-use JSON;
+use OpenSRF::Utils::JSON;
#
$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 {
$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);
);
} 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);
use OpenILS::Utils::FlatXML;
use OpenILS::Utils::Fieldmapper;
-use JSON;
+use OpenSRF::Utils::JSON;
use XML::LibXML;
use XML::LibXSLT;
use XML::LibXSLT;
use Unicode::Normalize;
-use JSON;
+use OpenSRF::Utils::JSON;
our (
$_parser,
use OpenILS::Utils::FlatXML;
use OpenILS::Utils::Fieldmapper;
-use JSON;
+use OpenSRF::Utils::JSON;
use OpenILS::Utils::Fieldmapper;
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(
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};
'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 ) {
use OpenSRF::System;
use XML::LibXML;
use OpenSRF::Utils::SettingsParser;
-use JSON;
+use OpenSRF::Utils::JSON;
sub new {
my ($class) = @_;
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;
}
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);
}
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;
if( UNIVERSAL::isa($arg, "Fieldmapper") ) {
return (defined $arg->id) ? $arg->id : '<new object>';
}
- return JSON->perl2JSON($arg);
+ return OpenSRF::Utils::JSON->perl2JSON($arg);
return "";
}
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 $arg = shift;
return "" unless defined $arg;
return $arg->id if UNIVERSAL::isa($arg, "Fieldmapper");
- return JSON->perl2JSON($arg);
+ return OpenSRF::Utils::JSON->perl2JSON($arg);
}
package Fieldmapper;
-use JSON;
+use OpenSRF::Utils::JSON;
use Data::Dumper;
use base 'OpenSRF::Application';
use OpenSRF::Utils::Logger;
}
}
- JSON->register_class_hint(
+ OpenSRF::Utils::JSON->register_class_hint(
hint => $pkg->json_hint,
name => $pkg,
type => 'array',
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;
close(F);
$logger->debug( "script result is [$res]" );
- return JSON->JSON2perl( $res );
+ return OpenSRF::Utils::JSON->JSON2perl( $res );
}
sub remove_path {
my $blocking = shift;
my $params = shift;
- my @p = @{ JSON->JSON2perl($params) };
+ my @p = @{ OpenSRF::Utils::JSON->JSON2perl($params) };
my $ctx = $self->context;
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');
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;
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;
use Apache2::RequestIO ();
use Apache2::RequestUtil;
-use JSON;
+use OpenSRF::Utils::JSON;
use CGI ();
}
if($err) {
- print JSON->perl2JSON($err);
+ print OpenSRF::Utils::JSON->perl2JSON($err);
return Apache2::Const::OK;
}
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" );
}
}
"Service: $service \nMethod: $method \nParams: @params \n" .
$response->stringify() . "\n",
};
- print JSON->perl2JSON($err);
+ print OpenSRF::Utils::JSON->perl2JSON($err);
$request->finish();
return 0;
}
"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;
}
warn "Results: \n";
warn Dumper \@results;
- print JSON->perl2JSON( \@results );
+ print OpenSRF::Utils::JSON->perl2JSON( \@results );
return 1;
}
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;
$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;
}
use strict;
use warnings;
-use JSON;
+use OpenSRF::Utils::JSON;
use OpenSRF::System;
my $config = shift || die "bootstrap config required\n";
use strict;
use warnings;
-use JSON;
+use OpenSRF::Utils::JSON;
use OpenSRF::System;
my $config = shift || die "bootstrap config required\n";
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;
next unless $bib;
if (uc($format) eq 'BRE') {
- print JSON->perl2JSON($bib);
+ print OpenSRF::Utils::JSON->perl2JSON($bib);
stats();
next;
}
use strict;
use warnings;
-use JSON;
+use OpenSRF::Utils::JSON;
use Data::Dumper;
use OpenSRF::System;
use OpenSRF::AppSession;
use strict; use warnings;
use Time::HiRes qw/time/;
use Data::Dumper;
-use JSON;
+use OpenSRF::Utils::JSON;
#-----------------------------------------------------------------------------
# Does a checkout, renew, and checkin
use LWP::UserAgent;
use HTTP::Request::Common;
use Data::Dumper;
-use JSON;
+use OpenSRF::Utils::JSON;
#-----------------------------------------------------------------------------
# Does a checkout, renew, and checkin
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;
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};
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";
}
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};
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);
}
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";
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;