5 use lib 'LIBDIR/perl5/';
8 use OpenSRF::Application;
9 use OpenSRF::EX qw/:try/;
10 use OpenSRF::AppSession;
11 use OpenSRF::Utils::SettingsClient;
12 use OpenILS::Application::AppUtils;
13 use OpenILS::Utils::Fieldmapper;
14 use Digest::MD5 qw/md5_hex/;
18 my ($od_length, $user, $password, $config) =
19 ('180 days', 'admin', 'open-ils', 'SYSCONFDIR/opensrf_core.xml');
22 'overdue=s' => \$od_length,
24 'password=s' => \$password,
25 'config=s' => \$config,
28 OpenSRF::System->bootstrap_client( config_file => $config );
29 Fieldmapper->import(IDL => OpenSRF::Utils::SettingsClient->new->config_value("IDL"));
31 my $auth = login($user,$password);
33 my $ses = OpenSRF::AppSession->create('open-ils.cstore');
34 my $req = $ses->request(
36 'open-ils.cstore.json_query',
37 { select => { circ => [ qw/id/ ] }, from => circ => where => { due_date => { ">" => { transform => "age", value => "340 days" } } } }
40 while ( my $res = $req->recv( timeout => 120 ) ) {
41 print $res->content->target_copy . "\n";
45 my( $username, $password, $type ) = @_;
49 my $seed = OpenILS::Application::AppUtils->simplereq(
51 'open-ils.auth.authenticate.init',
55 die("No auth seed. Couldn't talk to the auth server") unless $seed;
57 my $response = OpenILS::Application::AppUtils->simplereq(
59 'open-ils.auth.authenticate.complete',
60 { username => $username,
61 password => md5_hex($seed . md5_hex($password)),
64 die("No auth response returned on login.") unless $response;
66 my $authtime = $response->{payload}->{authtime};
67 my $authtoken = $response->{payload}->{authtoken};
69 die("Login failed for user $username!") unless $authtoken;