Hiya,
I'm getting raw marc data from a database, not from
a file. I was wondering how difficult it would be to create a
MARC::Record from my scalar variable, as opposed to having to
print it out to a file, and open the filehandle using MARC::Batch or
similar...
my sample code:
>>
$dbh = DBI-
>connect('dbi:Oracle:LIBR','train_treaddb','train_treaddb');
$sth = $dbh->prepare("select marc_record from bibblob_vw
".
"where bib_id =".$p);
$sth->execute();
@row =
$sth->fetchrow_array();
$sth->finish;
$dbh-
>disconnect;
#this is the marc scalar
$line =
@row[0];
<<
So, I'd like to be able to create a
MARC::Record from my $line var. I've tested the validity of the
data by writing another script that dumps $line to a file, then reads
the file in - that part works great!
Many
thanks,
Steve <smcphillips@nla.gov.au> - National
Library of Australia
Logged In: NO
Steve here again - found the MARC::File::USMARC->decode() function,
which I can use instead of creating a new MARC::Batch to get my
MARC::Record object.
Diff: