File: update_doc_insert.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 (37 lines) | stat: -rw-r--r-- 815 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
36
37
#!/usr/bin/env perl
use FindBin;
use lib "$FindBin::Bin/../lib";
use Catmandu::Sane;
use Catmandu::AlephX;
use Catmandu::Importer::AlephX;
use Catmandu::AlephX::Metadata::MARC::Aleph;
use Data::Dumper;
use File::Slurp;
use open qw(:std :utf8);

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

my $importer = Catmandu::Importer::AlephX->new(
  url => 'http://borges1.ugent.be/X',
  base => 'usm01'
);

my $marc = $importer->first();

print Dumper($marc);

my %args = (
  'library' => 'usm01',
  'doc_action' => 'UPDATE',
  'doc_number' => '000000000',
  marc => $marc
);
my $info = $aleph->update_doc(%args);
say ${ $info->content_ref };
if($info->is_success){
  say "all ok";
}else{
  say "test";
  say "num errors:".scalar(@{ $info->errors() });
  say STDERR join("\n",@{$info->errors});
}