> How do I make the MARC blob into a MARC::Record object (without having
> to first save it a file and read it in with MARC::File/Batch)?  The
> MARC blob is already in a variable, so it doesn't make sense (to me) to
> write it out to a file just so I can read it back in.  Unless I have
> to, natch.
> 

You should be able to create a MARC::Record object via MARC::File::USMARC from 
string (see decode). An example below
http://search.cpan.org/dist/MARC-Record/lib/MARC/File/USMARC.pm


So with per/Voyager I know I've done something like:

Had a query ...
SELECT BIB_ID, record_segment, seqnum
FROM UIUDB.BIB_DATA
WHERE BIB_ID = ?
ORDER BY seqnum ASC;

I prepare/execute that query with something like:

  $getBibRecordH->execute($row->{'BIBID'}) or $logger->logdie("Could not 
execute query to get Bib Record");
  while (my ($rec_id, $recseg, $seqnum) = $getBibRecordH->fetchrow_array) {
    $rawMARC .= $recseg ;
  }



  my $MARC = MARC::File::USMARC->decode($rawMARC);


There's also some nice ways if you're only using certain parts of the record to 
apply a filter,  although I don't have any examples off-hand.

If however you mean by the MARC blob you don't have a "complete" record but 
part, I'm less sure how to do that.  I'd just pull in the entire file.

Jon Gorman
University of Illinois



> 
> -- Michael
> 
> # Michael Doran, Systems Librarian
> # University of Texas at Arlington
> # 817-272-5326 office
> # 817-688-1926 mobile
> # do...@uta.edu
> # http://rocky.uta.edu/doran/

Reply via email to