[OPEN-ILS-DEV] OpenSRF API Question

Doug Kyle dkyle at grpl.org
Fri May 9 14:01:10 EDT 2008


I'm working on a small utility program that will pull up patron info.  
It's currently set up as a cgi script:
#!/usr/bin/perl
use CGI qw(:standard);
require '/usr/ports/Evergreen/Open-ILS/src/support-scripts/oils_header.pl';
my $bcode = param('barcode') || '0';
my $conf = '/openils/conf/opensrf_core.xml';
print header;
if ($bcode) {
        osrf_connect($conf);
        my $authtok = oils_login('<user>','<passwd>');
        $u = simplereq( ACTOR(), 
'open-ils.actor.user.fleshed.retrieve_by_barcode', $authtok, $bcode);
        print Dumper($u);
} else { print "Give me a barcode" }

 $u expands like so:
  DB<20> x $u
0  Fieldmapper::actor::user=ARRAY(0x209af20)
   0  undef
   1  undef
   2  undef
   3  ARRAY(0x2099830)
      0  Fieldmapper::actor::user_address=ARRAY(0x20996a0)
         0  undef
         1  undef
         2  undef
         3  'MAILING'
         4  'Grand Rapids'
         5  'USA'
         6  'Kent'
         7  2
         8  44918
         9  'MI'
         10  '3051 Hearland Ave'
         11  undef
         12  3
         13  't'
         14  'f'
   4  ARRAY(0x2099bf0)
      0  Fieldmapper::actor::card=ARRAY(0x20999f0)
         0  undef
         1  undef
         2  undef
         3  't'
         4  21298004609999
         5  3
         6  3
   5  undef
etc and so on.........

I'm wondering if there are existing methods for taking structures such 
as $u and mapping the appropriate names to the various array items?  and 
maybe doing some pretty output formatting?  I'm just starting to look, 
but thought I might save some time by asking.



More information about the Open-ils-dev mailing list