koha-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-devel] Re: [Koha] Z3950 Server, MARC::Record, how to build a recor


From: Mike Hansen
Subject: [Koha-devel] Re: [Koha] Z3950 Server, MARC::Record, how to build a record for Koha
Date: Tue Aug 26 08:12:53 2003

Hello,
        You might want to try $record->leader('                   '); right 
after you create the record object.  I am not familiar with the purpose of the 
leader so you may want to fill it with something more meaningful ;-]

Mike

On Tue, 26 Aug 2003 06:59:01 -0400
Joshua Ferraro <address@hidden> wrote:

> Hi everyone,
> 
> I have been working on a Z3950 server for Koha and I am finally at the point
> where the server works, and I need some help refining the records that I am 
> generating (eventually I will build in support for multiple formats; but for
> now I would be pretty excited if I could get it to generate "good" MARC)
> Basically, the Z3950 server uses SimpleServer, which has a fetch
> handler subroutine to fetch one record(the present handler will call 
> fetch_handler as often as necessary for the client's request).  So...here is 
> a snipit of code from my script where I attempt to generate a MARC record.  
> When I run the resulting string from this code through Paul's dumpmarc.pl it 
> complains about the leader.  MARC::Record experts: any ideas, suggestions as 
> to how to set the leader? Any other suggestions? (BTW: this is my first ever
> Perl script, so please don't laugh too hard:))
> 
> Thanks, 
> Joshua
> 
> 
> sub fetch_handler {
>         my ($args) = @_;
>         my $offset = $args->{OFFSET};
>         $offset -= 1;                   ## because $args->{OFFSET} 1 = record 
> #1
>         chomp (my $bibid = $bib_list[$offset]); ## Not sure about this
>         my $dbh = C4::Context->dbh;
>         my $sql_query = "SELECT tag, subfieldcode, subfieldvalue FROM 
> marc_subfi
> eld_table where bibid=?";
>         my $sth_get = $dbh->prepare("$sql_query");
>         $sth_get->execute($bibid);
> 
>         ## Build the record:
>         my $rec = MARC::Record->new();
> 
>         while (my @data=$sth_get->fetchrow_array) {
> 
>                 my $tag = $data[0];
>                 my $subfieldcode = $data[1];
>                 my $subfieldvalue = $data[2];
> 
>                 my $field = MARC::Field->new(
>                                                   $tag,'','',
>                                                   $subfieldcode => 
> $subfieldvalu
> e,
>                                             );
> 
>                 $rec->append_fields($field);
> 
>                 ## build the marc string and put into $record
>                 my $record = $rec->as_usmarc();
>                 $args->{RECORD} = $record;
>         }    
> _______________________________________________
> Koha mailing list
> address@hidden
> http://lists.katipo.co.nz/mailman/listinfo/koha





reply via email to

[Prev in Thread] Current Thread [Next in Thread]