X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=misc%2Fmigration_tools%2Frebuild_zebra.pl;h=31e81254903a64771208a85f9369c56d3a7b5b13;hb=263dded818da9d3ad0fa702f7bc848707e181211;hp=cd1227756ef7f1993ab6d20103918cf9c957a7ce;hpb=8f698965b1f368967b878db8adb3a6f785fa5f26;p=koha.git diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl index cd1227756e..31e8125490 100755 --- a/misc/migration_tools/rebuild_zebra.pl +++ b/misc/migration_tools/rebuild_zebra.pl @@ -309,7 +309,7 @@ sub export_marc_records_from_sth { my ($record_type, $sth, $directory, $as_xml, $noxml, $nosanitize) = @_; my $num_exported = 0; - open (OUT, ">:utf8 ", "$directory/exported_records") or die $!; + open my $fh, '>:encoding(UTF-8) ', "$directory/exported_records" or die $!; my $i = 0; my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField("items.itemnumber",''); while (my ($record_number) = $sth->fetchrow_array) { @@ -337,7 +337,7 @@ sub export_marc_records_from_sth { } } if ( $marcxml ) { - print OUT $marcxml if $marcxml; + print {$fh} $marcxml if $marcxml; $num_exported++; } next; @@ -350,7 +350,7 @@ sub export_marc_records_from_sth { # to care, though, at least if you're using the GRS-1 filter. It does # care if you're using the DOM filter, which requires valid XML file(s). eval { - print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc(); + print {$fh} ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc(); $num_exported++; }; if ($@) { @@ -359,7 +359,7 @@ sub export_marc_records_from_sth { } } print "\nRecords exported: $num_exported\n" if ( $verbose_logging ); - close OUT; + close $fh; return $num_exported; } @@ -367,7 +367,7 @@ sub export_marc_records_from_list { my ($record_type, $entries, $directory, $as_xml, $noxml, $records_deleted) = @_; my $num_exported = 0; - open (OUT, ">:utf8 ", "$directory/exported_records") or die $!; + open my $fh, '>:encoding(UTF-8)', "$directory/exported_records" or die $!; my $i = 0; # Skip any deleted records. We check for this anyway, but this reduces error spam @@ -384,12 +384,12 @@ sub export_marc_records_from_list { # strung together with no single root element. zebraidx doesn't seem # to care, though, at least if you're using the GRS-1 filter. It does # care if you're using the DOM filter, which requires valid XML file(s). - print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc(); + print {$fh} ($as_xml) ? $marc->as_xml_record(C4::Context->preference('marcflavour')) : $marc->as_usmarc(); $num_exported++; } } print "\nRecords exported: $num_exported\n" if ( $verbose_logging ); - close OUT; + close $fh; return $num_exported; } @@ -397,7 +397,7 @@ sub generate_deleted_marc_records { my ($record_type, $entries, $directory, $as_xml) = @_; my $records_deleted = {}; - open (OUT, ">:utf8 ", "$directory/exported_records") or die $!; + open my $fh, '>:encoding(UTF-8)', "$directory/exported_records" or die $!; my $i = 0; foreach my $record_number (map { $_->{biblio_auth_number} } @$entries ) { print "\r$i" unless ($i++ %100 or !$verbose_logging); @@ -413,12 +413,12 @@ sub generate_deleted_marc_records { fix_unimarc_100($marc); } - print OUT ($as_xml) ? $marc->as_xml_record(C4::Context->preference("marcflavour")) : $marc->as_usmarc(); + print {$fh} ($as_xml) ? $marc->as_xml_record(C4::Context->preference("marcflavour")) : $marc->as_usmarc(); $records_deleted->{$record_number} = 1; } print "\nRecords exported: $i\n" if ( $verbose_logging ); - close OUT; + close $fh; return $records_deleted; @@ -824,8 +824,8 @@ if ($authorities) { # AUTHORITIES : copying mandatory files # unless (-f C4::Context->zebraconfig('authorityserver')->{config}) { - open ZD,">:utf8 ",C4::Context->zebraconfig('authorityserver')->{config}; - print ZD " + open my $zd, '>:encoding(UTF-8)' ,C4::Context->zebraconfig('authorityserver')->{config}; + print {$zd} " # generated by KOHA/misc/migration_tools/rebuild_zebra.pl profilePath:\${srcdir:-.}:$authorityserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ @@ -969,8 +969,8 @@ if ($biblios) { # BIBLIOS : copying mandatory files # unless (-f C4::Context->zebraconfig('biblioserver')->{config}) { - open ZD,">:utf8 ",C4::Context->zebraconfig('biblioserver')->{config}; - print ZD " + open my $zd, '>:encoding(UTF-8)', C4::Context->zebraconfig('biblioserver')->{config}; + print {$zd} " # generated by KOHA/misc/migrtion_tools/rebuild_zebra.pl profilePath:\${srcdir:-.}:$biblioserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/