8 use Data::Dump qw/dump/;
10 my $limit = $ENV{LIMIT} || 50;
12 my $dsn = 'DBI:mysql:dbname=koha_ffzg';
15 biblionumber,itemnumber,title,
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";
39 warn "# NAME = ",dump( $sth->{NAME} );
40 print $tsv_fh "#", join("\t", @{ $sth->{NAME} }), "\n";
44 while ( my $row = $sth->fetchrow_hashref ) {
46 # warn "# row = ",dump( $row );
48 my $rec = tell $marc_fh;
49 foreach ( keys %$row ) {
53 print $marc_fh $row->{marc};
57 next unless defined $d;
59 # $d =~ s{</?\w+>}{ }gs;
66 print $tsv_fh "$rec\n";
69 system "ls -al $path*";
70 system "rsync -v $path* 10.60.0.82:/tmp/";