Bug 17600: Standardize our EXPORT_OK
[srvgit] / misc / migration_tools / 22_to_30 / export_Authorities_xml.pl
index 42d2e5c..4145fc3 100755 (executable)
@@ -1,17 +1,15 @@
 #!/usr/bin/perl
-#use strict;
-#use warnings; FIXME - Bug 2505
+use Modern::Perl;
 BEGIN {
     # find Koha's Perl modules
     # test carefully before changing this
-    use FindBin;
+    use FindBin ();
     eval { require "$FindBin::Bin/../../kohalib.pl" };
 }
 use C4::Context;
 use MARC::File::XML(BinaryEncoding=>"utf8");
-use MARC::Record;
 use C4::AuthoritiesMarc;
-use POSIX;
+use POSIX qw( close localtime open sprintf time );
 MARC::File::XML::default_record_format("UNIMARCAUTH");
 my $dbh = C4::Context->dbh;
 my $rq= $dbh->prepare(qq|
@@ -31,7 +29,9 @@ open my $fileoutput, '>:encoding(UTF-8)', "./$filename/$authid.xml" or die "unab
                        
 #  if (C4::Context->preference('marcflavour') eq "UNIMARC"){
        $record->leader('     nac  22     1u 4500');
-    my $string=$1 if $time=~m/([0-9\-]+)/;
+    my @time = localtime(time);
+    my $time = sprintf('%04d%02d%02d', $time[5] + 1900, $time[4] + 1, $time[3]);
+    my $string = ($time=~m/([0-9\-]+)/) ? $1 : undef;
     $string=~s/\-//g;
      $string = sprintf("%-*s",26, $string);
      substr($string,9,6,"frey50");