[Koha-patches] [PATCH] Adding BEGIN { $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser"; } to all scripts and modules that use MARC::File::XML. This removes the need to edit parserdetails.ini

Chris Cormack chrisc at catalyst.net.nz
Mon Apr 19 04:47:22 CEST 2010


---
 C4/Biblio.pm                                       |    2 ++
 C4/Record.pm                                       |    7 ++++++-
 cataloguing/addbiblio.pl                           |    3 +++
 cataloguing/additem.pl                             |    3 +++
 cataloguing/moveitem.pl                            |    2 ++
 installer/data/mysql/update22to30.pl               |    1 +
 installer/data/mysql/updatedatabase.pl             |    2 ++
 misc/batchImportMARCWithBiblionumbers.pl           |   17 +++++++++++++++++
 misc/batchupdateISBNs.pl                           |    2 ++
 misc/maintenance/MARC21_utf8_flag_fix.pl           |    3 +++
 .../migration_tools/22_to_30/export_Authorities.pl |    2 ++
 .../22_to_30/export_Authorities_xml.pl             |    2 ++
 .../22_to_30/move_marc_to_biblioitems.pl           |    2 ++
 misc/migration_tools/bulkauthimport.pl             |    2 ++
 misc/migration_tools/bulkmarcimport.pl             |    2 ++
 misc/sax_parser_print.pl                           |    1 +
 misc/sax_parser_test.pl                            |    1 +
 17 files changed, 53 insertions(+), 1 deletions(-)

diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index e24bee8..e08589d 100644
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -17,6 +17,8 @@ package C4::Biblio;
 # with Koha; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
+BEGIN { $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser"; } # Make sure MARC::File::XML uses the write parser
+
 use strict;
 use warnings;
 
diff --git a/C4/Record.pm b/C4/Record.pm
index 8dd073b..c26698d 100644
--- a/C4/Record.pm
+++ b/C4/Record.pm
@@ -2,6 +2,7 @@ package C4::Record;
 #
 # Copyright 2006 (C) LibLime
 # Joshua Ferraro <jmf at liblime.com>
+# Copyright 2010 Catalyst IT Limited
 #
 # This file is part of Koha.
 #
@@ -19,7 +20,11 @@ package C4::Record;
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 #
 #
-use strict;# use warnings; #FIXME: turn off warnings before release
+
+BEGIN { $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser"; } # Make sure MARC::File::XML uses the write parser
+
+use strict;
+# use warnings; #FIXME: turn off warnings before release
 
 # please specify in which methods a given module is used
 use MARC::Record; # marc2marcxml, marcxml2marc, html2marc, changeEncoding
diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl
index 845ee85..a391404 100755
--- a/cataloguing/addbiblio.pl
+++ b/cataloguing/addbiblio.pl
@@ -2,6 +2,7 @@
 
 
 # Copyright 2000-2002 Katipo Communications
+# Copyright 2010 Catalyst IT Limited
 #
 # This file is part of Koha.
 #
@@ -18,6 +19,8 @@
 # with Koha; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
+BEGIN { $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser"; } # Make sure MARC::File::XML uses the write parser
+
 use strict;
 use CGI;
 use C4::Output;
diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl
index a89a3c5..dbb4b7e 100755
--- a/cataloguing/additem.pl
+++ b/cataloguing/additem.pl
@@ -2,6 +2,7 @@
 
 
 # Copyright 2000-2002 Katipo Communications
+# Copyright 2010 Catalyst IT Limited
 #
 # This file is part of Koha.
 #
@@ -18,6 +19,8 @@
 # with Koha; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
+BEGIN { $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser"; } # Make sure MARC::File::XML uses the write parser
+
 use CGI;
 use strict;
 use C4::Auth;
diff --git a/cataloguing/moveitem.pl b/cataloguing/moveitem.pl
index b1542e3..08b6c46 100755
--- a/cataloguing/moveitem.pl
+++ b/cataloguing/moveitem.pl
@@ -19,6 +19,8 @@
 # with Koha; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
+BEGIN { $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser"; } # Make sure MARC::File::XML uses the write parser
+
 use CGI;
 use strict;
 use C4::Auth;
diff --git a/installer/data/mysql/update22to30.pl b/installer/data/mysql/update22to30.pl
index 435d767..3551994 100755
--- a/installer/data/mysql/update22to30.pl
+++ b/installer/data/mysql/update22to30.pl
@@ -11,6 +11,7 @@
 # - Would also be a good idea to offer to do a backup at this time...
 
 # NOTE:  If you do something more than once in here, make it table driven.
+BEGIN { $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser"; } # Make sure MARC::File::XML uses the write parser
 use strict;
 
 # CPAN modules
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index eb364d3..bdbc80f 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -14,6 +14,8 @@
 
 # NOTE: Please keep the version in kohaversion.pl up-to-date!
 
+BEGIN { $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser"; } # Make sure MARC::File::XML uses the write parser
+
 use strict;
 use warnings;
 
diff --git a/misc/batchImportMARCWithBiblionumbers.pl b/misc/batchImportMARCWithBiblionumbers.pl
index a1bf26e..0d81015 100755
--- a/misc/batchImportMARCWithBiblionumbers.pl
+++ b/misc/batchImportMARCWithBiblionumbers.pl
@@ -1,12 +1,29 @@
 #!/usr/bin/perl
 # load records that already have biblionumber set into a koha system
 # Written by TG on 10/04/2006
+
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
 use strict;
 BEGIN {
     # find Koha's Perl modules
     # test carefully before changing this
     use FindBin;
     eval { require "$FindBin::Bin/kohalib.pl" };
+    $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser";
 }
 
 # Koha modules used
diff --git a/misc/batchupdateISBNs.pl b/misc/batchupdateISBNs.pl
index 03d5bba..180a596 100755
--- a/misc/batchupdateISBNs.pl
+++ b/misc/batchupdateISBNs.pl
@@ -29,6 +29,8 @@ BEGIN {
     # test carefully before changing this
     use FindBin;
     eval { require "$FindBin::Bin/kohalib.pl" };
+    $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser";
+    
 }
 use C4::Context;
 use MARC::File::XML;
diff --git a/misc/maintenance/MARC21_utf8_flag_fix.pl b/misc/maintenance/MARC21_utf8_flag_fix.pl
index e7e9156..fbff241 100755
--- a/misc/maintenance/MARC21_utf8_flag_fix.pl
+++ b/misc/maintenance/MARC21_utf8_flag_fix.pl
@@ -1,6 +1,7 @@
 #!/usr/bin/perl
 #
 # Copyright 2009 Liblime
+# Copyright 2010 Catalyst IT
 #
 # This file is part of Koha.
 #
@@ -17,6 +18,8 @@
 # with Koha; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
+BEGIN { $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser"; } # Make sure correct sax parser is used
+
 use strict;
 use warnings;
 
diff --git a/misc/migration_tools/22_to_30/export_Authorities.pl b/misc/migration_tools/22_to_30/export_Authorities.pl
index 8327cf7..76ff984 100755
--- a/misc/migration_tools/22_to_30/export_Authorities.pl
+++ b/misc/migration_tools/22_to_30/export_Authorities.pl
@@ -4,6 +4,8 @@ BEGIN {
     # test carefully before changing this
     use FindBin;
     eval { require "$FindBin::Bin/../../kohalib.pl" };
+    $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser"; # Make sure correct sax parser is used  
+    
 }
 use C4::Context;
 #use MARC::File::XML(BinaryEncoding=>"utf8");
diff --git a/misc/migration_tools/22_to_30/export_Authorities_xml.pl b/misc/migration_tools/22_to_30/export_Authorities_xml.pl
index 635a414..ca2f571 100755
--- a/misc/migration_tools/22_to_30/export_Authorities_xml.pl
+++ b/misc/migration_tools/22_to_30/export_Authorities_xml.pl
@@ -4,6 +4,8 @@ BEGIN {
     # test carefully before changing this
     use FindBin;
     eval { require "$FindBin::Bin/../../kohalib.pl" };
+    $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser";  # Make sure correct sax parser is used  
+    
 }
 use C4::Context;
 use MARC::File::XML(BinaryEncoding=>"utf8");
diff --git a/misc/migration_tools/22_to_30/move_marc_to_biblioitems.pl b/misc/migration_tools/22_to_30/move_marc_to_biblioitems.pl
index 883af15..40c7eb0 100755
--- a/misc/migration_tools/22_to_30/move_marc_to_biblioitems.pl
+++ b/misc/migration_tools/22_to_30/move_marc_to_biblioitems.pl
@@ -7,6 +7,8 @@ BEGIN {
     # test carefully before changing this
     use FindBin;
     eval { require "$FindBin::Bin/../../kohalib.pl" };
+    $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser"; # Make sure correct sax parser is used  
+    
 }
 use C4::Context;
 use C4::Biblio;
diff --git a/misc/migration_tools/bulkauthimport.pl b/misc/migration_tools/bulkauthimport.pl
index d3dcadc..6af7a82 100755
--- a/misc/migration_tools/bulkauthimport.pl
+++ b/misc/migration_tools/bulkauthimport.pl
@@ -7,6 +7,8 @@ BEGIN {
     # test carefully before changing this
     use FindBin;
     eval { require "$FindBin::Bin/kohalib.pl" };
+    $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser"; # Make sure correct sax parser is used  
+    
 }
 
 # Koha modules used
diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl
index da0ebf7..5b1d823 100755
--- a/misc/migration_tools/bulkmarcimport.pl
+++ b/misc/migration_tools/bulkmarcimport.pl
@@ -9,6 +9,8 @@ BEGIN {
     # test carefully before changing this
     use FindBin;
     eval { require "$FindBin::Bin/../kohalib.pl" };
+    $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser"; # Make sure correct sax parser is used  
+    
 }
 
 # Koha modules used
diff --git a/misc/sax_parser_print.pl b/misc/sax_parser_print.pl
index d206a5e..ab5d1ff 100755
--- a/misc/sax_parser_print.pl
+++ b/misc/sax_parser_print.pl
@@ -3,6 +3,7 @@
 
 use strict;
 use warnings;
+BEGIN { $XML::SAX::ParserPackage = "XML::LibXML::SAX::Parser"; }
 use XML::SAX::ParserFactory;
 
 my $parser = XML::SAX::ParserFactory->parser();
diff --git a/misc/sax_parser_test.pl b/misc/sax_parser_test.pl
index 07d672c..f1e9ae4 100755
--- a/misc/sax_parser_test.pl
+++ b/misc/sax_parser_test.pl
@@ -1,4 +1,5 @@
 #!/usr/bin/perl
+BEGIN { $XML::SAX::ParserPackage = "XML::LibXML::SAX"; }
 use XML::SAX;
 my $parser = XML::SAX::ParserFactory->parser(
 Handler => MySAXHandler->new
-- 
1.6.3.3



More information about the Koha-patches mailing list