File: publish_avail.pl

package info (click to toggle)
libcatmandu-alephx-perl 1.073-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 688 kB
  • sloc: perl: 2,616; xml: 71; makefile: 10
file content (35 lines) | stat: -rw-r--r-- 843 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env perl
use FindBin;
use lib "$FindBin::Bin/../lib";
use Catmandu::Sane;
use Catmandu::AlephX;
use JSON qw(to_json);
use open qw(:std :utf8);
use Catmandu::Exporter::MARC;
use Data::Dumper;

my $aleph = Catmandu::AlephX->new(url => "http://borges1.ugent.be/X");

my $exporter = Catmandu::Exporter::MARC->new(type => 'ALEPHSEQ');

my $publish = $aleph->publish_avail(doc_num => '000196220,001313162,001484478,001484538,001317121,000000000',library=>'rug01');

#say ${ $publish->content_ref };

if($publish->is_success){

  for my $record(@{ $publish->records }){

    if($record->metadata->data->{record}){
      $exporter->add($record->metadata->data);
      $exporter->commit;
    }
    else{
      say "nothing for ".$record->metadata->data->{_id};
    }

    say "\n---";
  }
}else{
  say STDERR join('',@{$publish->errors});
}