8 use Data::Dump qw/dump/;
10 my $limit = $ENV{LIMIT} || 10;
12 my $dsn = 'DBI:mysql:dbname=koha_ffzg';
18 join biblioitems using (biblionumber)
19 join biblio using (biblionumber)
20 where location = 'MKP'
25 my $path = "/dev/shm/$1" if $dsn =~ m/=(.+)/;
27 open(my $marc_fh, '>', "$path.marc");
28 open(my $tsv_fh, '>', "$path.tsv");
31 my $dbh = DBI->connect( $dsn, '', '', { RaiseError => 1 } ) || die $DBI::errstr;
32 #$dbh->do( qq{ set client_encoding='utf-8' } );
35 my $sth = $dbh->prepare( $sql );
38 warn "# ", $sth->rows,"\n";
42 while ( my $row = $sth->fetchrow_hashref ) {
44 # warn "# row = ",dump( $row );
46 my $rec = tell $marc_fh;
47 foreach ( keys %$row ) {
51 print $marc_fh $row->{marc};
55 next unless defined $d;
57 # $d =~ s{</?\w+>}{ }gs;
64 print $tsv_fh "$rec\n";
67 system "ls -al $path*";
68 system "rsync -v $path* 10.60.0.82:/tmp/";