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