2 use strict; use warnings;
4 my $config = shift || die "Please specify a config file\n";
5 my $context = shift || 'opensrf';
7 my $oils_reqr = '/openils/bin/oils_requestor'; # XXX command line param
9 if(1) { # XXX command line param
11 # ------------------------------------------------------------
12 # This sends the method calls to storage via oils_requestor,
13 # which is able to process the results much faster
14 # Make this the default for now.
15 # ------------------------------------------------------------
18 use IPC::Open2 qw/open2/;
23 my $command = "echo \"open-ils.storage $method\" | $oils_reqr -f $config -c $context";
26 my ($child_stdout, $child_stdin);
27 my $pid = open2($child_stdout, $child_stdin, $command);
29 for my $barcode (<$child_stdout>) {
30 next if $barcode =~ /^oils/o; # hack to chop out the oils_requestor prompt
32 $barcode = JSON->JSON2perl($barcode);
33 print "$barcode $flag\n" if $barcode;
37 waitpid($pid, 0); # don't leave any zombies (see ipc::open2)
40 runmethod('open-ils.storage.actor.user.lost_barcodes', 'L');
41 runmethod('open-ils.storage.actor.user.barred_barcodes', 'B');
42 runmethod('open-ils.storage.actor.user.penalized_barcodes', 'D');
43 # too many, makes the file too large for download
44 #runmethod('open-ils.storage.actor.user.expired_barcodes', 'E');
49 # ------------------------------------------------------------
50 # Uses the traditional opensrf Perl API approach
51 # ------------------------------------------------------------
53 use OpenSRF::EX qw(:try);
55 use OpenSRF::AppSession;
57 my $config = shift || die "Please specify a config file\n";
59 OpenSRF::System->bootstrap_client( config_file => $config );
61 my $ses = OpenSRF::AppSession->connect( 'open-ils.storage' );
63 my $lost = $ses->request( 'open-ils.storage.actor.user.lost_barcodes' );
64 while (my $resp = $lost->recv ) {
65 print $resp->content . " L\n";
69 if(0) { # XXX just too many... arg
70 my $expired = $ses->request( 'open-ils.storage.actor.user.expired_barcodes' );
71 while (my $resp = $expired->recv ) {
72 print $resp->content . " E\n";
77 my $barred = $ses->request( 'open-ils.storage.actor.user.barred_barcodes' );
78 while (my $resp = $barred->recv ) {
79 print $resp->content . " B\n";
83 my $penalized = $ses->request( 'open-ils.storage.actor.user.penalized_barcodes' );
84 while (my $resp = $penalized->recv ) {
85 print $resp->content . " D\n";