]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/examples/json-request-test.pl
Merge Dan Wells' changes to the serial schema from the
[working/Evergreen.git] / Open-ILS / examples / json-request-test.pl
1 #!/usr/bin/perl -w
2 use strict;
3 use lib '../src/perlmods/';
4 use lib '../../OpenSRF/src/perlmods/';
5 use lib '../src/perlmods/OpenILS/Utils/';
6
7 use OpenSRF::Utils::JSON;
8 use OpenSRF::System;
9 use OpenILS::Utils::ScriptRunner;
10 use OpenSRF::Utils::Logger;
11 use OpenSRF::Utils::SettingsClient;
12 use OpenSRF::EX qw(:try);
13 use Fieldmapper (IDL => 'fm_IDL.xml');
14
15 unless (@ARGV > 1) {
16         print <<USAGE;
17 Usage: $0 /openils-root-dir script.js
18 USAGE
19 }
20
21 my $root = shift(@ARGV);
22
23 OpenSRF::System->bootstrap_client( config_file => $root.'/conf/opensrf_core.xml');
24
25 try {
26         OpenILS::Utils::ScriptRunner->add_path($root.'/var/web/opac/common/js/');
27         OpenILS::Utils::ScriptRunner->add_path('../src/javascript/backend/libs/');
28         OpenILS::Utils::ScriptRunner->add_path('./');
29
30         print OpenSRF::Utils::JSON->perl2JSON( OpenILS::Utils::ScriptRunner->new( file => shift(@ARGV) )->run );
31         #print OpenSRF::Utils::JSON->perl2JSON( OpenILS::Utils::ScriptRunner->new->run( shift(@ARGV) ) );
32
33 } otherwise {
34         warn 'crap:'.shift();
35 };
36