From b8a58c493493f8c9aa16a9ce621609c6dcb4a5f6 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 14 Dec 2007 14:24:19 -0600 Subject: [PATCH] installer: command-line scripts improve finding C4 modules Command-line scripts now use a new SCRIPT_DIR/kohalib.pl to put installed location of Koha's Perl modules into @INC. --- Makefile.PL | 3 +- misc/benchmark.pl | 8 ++- misc/bulkauthimport.pl | 6 +++ misc/bulkupdate.pl | 8 ++- misc/cleanmarcdb.pl | 6 +++ misc/commit_biblios_file.pl | 6 +++ misc/compare_iso_and_marc_parameters.pl | 6 +++ misc/cronjobs/build_browser_and_cloud.pl | 6 +++ misc/cronjobs/j2a.pl | 7 +++ misc/cronjobs/longoverdue.pl | 8 ++- misc/cronjobs/notifyMailsOp.pl | 6 +++ misc/cronjobs/overduenotices-30.pl | 6 +++ misc/cronjobs/overduenotices.pl | 6 +++ misc/cronjobs/reservefix.pl | 8 ++- misc/cronjobs/services_throttle.pl | 6 +++ misc/cronjobs/smsoverdues.pl | 7 +++ misc/cronjobs/update_items.pl | 6 +++ misc/cronjobs/zebraqueue_start.pl | 7 ++- misc/dumpmarc.pl | 6 +++ misc/exportauth.pl | 6 +++ misc/fines-sanop.pl | 8 ++- misc/fines2.pl | 9 +++- misc/kohalib.pl | 51 +++++++++++++++++++ misc/marcimport_to_biblioitems.pl | 6 +++ misc/merge_authority.pl | 6 +++ .../22_to_30/convert_to_utf8.pl | 8 ++- .../22_to_30/export_Authorities.pl | 6 +++ .../22_to_30/export_Authorities_xml.pl | 6 +++ .../22_to_30/missing090field.pl | 6 +++ .../22_to_30/move_marc_to_authheader.pl | 7 ++- .../22_to_30/move_marc_to_biblioitems.pl | 9 +++- .../22_to_30/rebuild_leader.pl | 6 +++ .../22_to_30/rebuild_unimarc_100.pl | 6 +++ misc/migration_tools/bulkmarcimport.pl | 6 +++ misc/missing090field.pl | 6 +++ misc/rebuild_marc_newframework.pl | 6 +++ misc/rebuildnonmarc.pl | 6 +++ .../make_spellcheck_suggest.pl | 8 ++- misc/stage_biblios_file.pl | 6 +++ misc/sync_koha_plugin.pl | 6 +++ misc/xmlintobiblioitems.pl | 8 ++- misc/zebraqueue_daemon.pl | 6 +++ 42 files changed, 303 insertions(+), 17 deletions(-) create mode 100644 misc/kohalib.pl diff --git a/Makefile.PL b/Makefile.PL index b3b5002aa7..9898c846e5 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -411,7 +411,8 @@ if ($config{'INSTALL_ZEBRA'} eq "yes") { if ($config{'INSTALL_MODE'} ne "dev") { push @{ $pl_files->{'rewrite-config.PL'} }, ( - 'blib/PERL_MODULE_DIR/C4/Context.pm' + 'blib/PERL_MODULE_DIR/C4/Context.pm', + 'blib/SCRIPT_DIR/kohalib.pl' ); } diff --git a/misc/benchmark.pl b/misc/benchmark.pl index b3f5458a14..5d7608446d 100755 --- a/misc/benchmark.pl +++ b/misc/benchmark.pl @@ -1,8 +1,14 @@ #!/usr/bin/perl +use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} use HTTPD::Bench::ApacheBench; use C4::Context; -use strict; # 1st, find some maximal values my $dbh=C4::Context->dbh(); diff --git a/misc/bulkauthimport.pl b/misc/bulkauthimport.pl index 285903e0d9..cd80aba024 100755 --- a/misc/bulkauthimport.pl +++ b/misc/bulkauthimport.pl @@ -2,6 +2,12 @@ # small script that import an iso2709 file into koha 2.0 use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} # Koha modules used use MARC::File::USMARC; diff --git a/misc/bulkupdate.pl b/misc/bulkupdate.pl index 385f6f2165..66ccc0a52a 100755 --- a/misc/bulkupdate.pl +++ b/misc/bulkupdate.pl @@ -23,7 +23,13 @@ =cut - +use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} use C4::Context; use MARC::File::XML; use MARC::Record; diff --git a/misc/cleanmarcdb.pl b/misc/cleanmarcdb.pl index 682e473ec1..04c071ad5a 100755 --- a/misc/cleanmarcdb.pl +++ b/misc/cleanmarcdb.pl @@ -2,6 +2,12 @@ # small script that rebuilds the non-MARC DB use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} # Koha modules used # use MARC::File::USMARC; diff --git a/misc/commit_biblios_file.pl b/misc/commit_biblios_file.pl index f0cbd06d3e..4c8d8ac3d1 100755 --- a/misc/commit_biblios_file.pl +++ b/misc/commit_biblios_file.pl @@ -1,6 +1,12 @@ #!/usr/bin/perl use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} use C4::Context; use C4::ImportBatch; diff --git a/misc/compare_iso_and_marc_parameters.pl b/misc/compare_iso_and_marc_parameters.pl index 46a12a1f16..e3f86b6173 100755 --- a/misc/compare_iso_and_marc_parameters.pl +++ b/misc/compare_iso_and_marc_parameters.pl @@ -3,6 +3,12 @@ use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} # Koha modules used use C4::Context; diff --git a/misc/cronjobs/build_browser_and_cloud.pl b/misc/cronjobs/build_browser_and_cloud.pl index d8045d6b28..f4546e928c 100755 --- a/misc/cronjobs/build_browser_and_cloud.pl +++ b/misc/cronjobs/build_browser_and_cloud.pl @@ -2,6 +2,12 @@ # small script that builds the tag cloud use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} use C4::Koha; use C4::Context; diff --git a/misc/cronjobs/j2a.pl b/misc/cronjobs/j2a.pl index d83ec4bd4b..de648ca290 100755 --- a/misc/cronjobs/j2a.pl +++ b/misc/cronjobs/j2a.pl @@ -1,6 +1,13 @@ #!/usr/bin/perl #run nightly -- changes J to A on someone's 18th birthday use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} + use C4::Context; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); diff --git a/misc/cronjobs/longoverdue.pl b/misc/cronjobs/longoverdue.pl index 000d662a47..256cd856fe 100755 --- a/misc/cronjobs/longoverdue.pl +++ b/misc/cronjobs/longoverdue.pl @@ -12,9 +12,13 @@ # 1.0.0 2004/04/01: original version #----------------------------------- -use lib '/usr/local/koha/intranet/modules/'; - use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} use C4::Context; my $dbh = C4::Context->dbh; diff --git a/misc/cronjobs/notifyMailsOp.pl b/misc/cronjobs/notifyMailsOp.pl index 54811a0d7c..720ffbc077 100755 --- a/misc/cronjobs/notifyMailsOp.pl +++ b/misc/cronjobs/notifyMailsOp.pl @@ -1,4 +1,10 @@ use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} use C4::Context; use C4::Dates qw/format_date/; use Mail::Sendmail; # comment out if not doing e-mail notices diff --git a/misc/cronjobs/overduenotices-30.pl b/misc/cronjobs/overduenotices-30.pl index 6ffe7b435a..b493f989b7 100755 --- a/misc/cronjobs/overduenotices-30.pl +++ b/misc/cronjobs/overduenotices-30.pl @@ -30,6 +30,12 @@ # Suite 330, Boston, MA 02111-1307 USA use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} use C4::Context; use C4::Dates qw/format_date/; use Mail::Sendmail; # comment out if not doing e-mail notices diff --git a/misc/cronjobs/overduenotices.pl b/misc/cronjobs/overduenotices.pl index 0366cfa26f..9bfdecb32e 100755 --- a/misc/cronjobs/overduenotices.pl +++ b/misc/cronjobs/overduenotices.pl @@ -35,6 +35,12 @@ # Suite 330, Boston, MA 02111-1307 USA use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} use C4::Context; use C4::Dates; use Mail::Sendmail; # comment out if not doing e-mail notices diff --git a/misc/cronjobs/reservefix.pl b/misc/cronjobs/reservefix.pl index 61b9956a26..aac1cfd365 100755 --- a/misc/cronjobs/reservefix.pl +++ b/misc/cronjobs/reservefix.pl @@ -12,9 +12,13 @@ # 1.0.0 2004/02/22: original version #----------------------------------- -use lib '/usr/local/koha/intranet/modules/'; - use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} use C4::Context; use Date::Manip; use Mail::Sendmail; diff --git a/misc/cronjobs/services_throttle.pl b/misc/cronjobs/services_throttle.pl index 39bf2696bc..0d0d6be446 100755 --- a/misc/cronjobs/services_throttle.pl +++ b/misc/cronjobs/services_throttle.pl @@ -2,6 +2,12 @@ #run nightly -- resets the services throttle use strict; use warnings; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} use C4::Context; my $dbh=C4::Context->dbh; diff --git a/misc/cronjobs/smsoverdues.pl b/misc/cronjobs/smsoverdues.pl index 52a131909a..3e5b2944b3 100755 --- a/misc/cronjobs/smsoverdues.pl +++ b/misc/cronjobs/smsoverdues.pl @@ -27,6 +27,13 @@ # $Id: sendoverdues.pl,v 1.1.2.1 2007/03/26 22:38:09 tgarip1957 Exp $ +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} + use C4::Context; use C4::Search; use C4::Circulation; diff --git a/misc/cronjobs/update_items.pl b/misc/cronjobs/update_items.pl index 97afefcbcd..15b8249a23 100755 --- a/misc/cronjobs/update_items.pl +++ b/misc/cronjobs/update_items.pl @@ -1,6 +1,12 @@ #!/usr/bin/perl use strict; use warnings; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} use C4::Context; use C4::Biblio; use MARC::Record; diff --git a/misc/cronjobs/zebraqueue_start.pl b/misc/cronjobs/zebraqueue_start.pl index b79aeaaa45..52c8fe0ef7 100755 --- a/misc/cronjobs/zebraqueue_start.pl +++ b/misc/cronjobs/zebraqueue_start.pl @@ -2,7 +2,12 @@ # script that starts the zebraquee # Written by TG on 01/08/2006 use strict; - +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} use C4::Context; use C4::Biblio; diff --git a/misc/dumpmarc.pl b/misc/dumpmarc.pl index dd4b44a972..b8fba0c68d 100755 --- a/misc/dumpmarc.pl +++ b/misc/dumpmarc.pl @@ -3,6 +3,12 @@ use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} # Koha modules used use MARC::File::USMARC; diff --git a/misc/exportauth.pl b/misc/exportauth.pl index b1dad03a71..109713fd82 100755 --- a/misc/exportauth.pl +++ b/misc/exportauth.pl @@ -4,6 +4,12 @@ # use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} require Exporter; use C4::Auth; diff --git a/misc/fines-sanop.pl b/misc/fines-sanop.pl index f1d0a770ba..02cca26940 100755 --- a/misc/fines-sanop.pl +++ b/misc/fines-sanop.pl @@ -26,12 +26,18 @@ # Suite 330, Boston, MA 02111-1307 USA +use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} use C4::Context; use C4::Circulation; use C4::Overdues; use Date::Manip qw/Date_DaysSince1BC/; use C4::Biblio; -use strict; open (FILE,'>/tmp/fines') || die; # FIXME diff --git a/misc/fines2.pl b/misc/fines2.pl index 554a65c738..596e664a40 100755 --- a/misc/fines2.pl +++ b/misc/fines2.pl @@ -26,12 +26,19 @@ # Suite 330, Boston, MA 02111-1307 USA +use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} + use C4::Context; use C4::Circulation; use C4::Overdues; use Date::Manip; use C4::Biblio; -use strict; open (FILE,'>/tmp/fines') || die; # FIXME diff --git a/misc/kohalib.pl b/misc/kohalib.pl new file mode 100644 index 0000000000..c6f2710e85 --- /dev/null +++ b/misc/kohalib.pl @@ -0,0 +1,51 @@ +#!/usr/bin/perl + +# Copyright (C) 2007 LibLime +# +# 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., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + +# This script is used by command-line utilities to set +# @INC properly -- specifically, to point to the directory +# containing the installed version of the C4 modules. +# +# This depends on the installer replacing the \_\_PERL_MODULE_DIR\_\_ +# string with the path to the Koha modules directory. This is done +# only during a 'standard' or 'single' mode installation. If Koha +# is being run from a git checkout (and thus installed in 'dev' mode), +# this is a no-op. +# +# To use this script, a command-line utility should do the following before +# 'use'ing any C4 modules. +# +# BEGIN { +# use FindBin; +# eval { require "$FindBin::Bin/kohalib.pl" }; +# # adjust path to point to kohalib.pl relative +# # to location of script +# } +# + +use strict; + +my $module_dir; +BEGIN { + $module_dir = '__PERL_MODULE_DIR__'; + die if $module_dir =~ /^[_]{2}PERL_MODULE_DIR[_]{2}$/; +} + +use lib $module_dir; + +1; diff --git a/misc/marcimport_to_biblioitems.pl b/misc/marcimport_to_biblioitems.pl index f56f72dc3a..95ccde52b6 100755 --- a/misc/marcimport_to_biblioitems.pl +++ b/misc/marcimport_to_biblioitems.pl @@ -2,6 +2,12 @@ # script that correct the marcxml from in biblioitems # Written by TG on 10/04/2006 use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} # Koha modules used diff --git a/misc/merge_authority.pl b/misc/merge_authority.pl index 5f6a7ae739..a423ddc192 100755 --- a/misc/merge_authority.pl +++ b/misc/merge_authority.pl @@ -2,6 +2,12 @@ # script that rebuild thesaurus from biblio table. use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} # Koha modules used use MARC::File::USMARC; diff --git a/misc/migration_tools/22_to_30/convert_to_utf8.pl b/misc/migration_tools/22_to_30/convert_to_utf8.pl index 204364f2c1..bad4b96902 100755 --- a/misc/migration_tools/22_to_30/convert_to_utf8.pl +++ b/misc/migration_tools/22_to_30/convert_to_utf8.pl @@ -2,8 +2,14 @@ # small script to convert mysql tables to utf-8 -use C4::Context; use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../../kohalib.pl" }; +} +use C4::Context; my $dbh=C4::Context->dbh(); diff --git a/misc/migration_tools/22_to_30/export_Authorities.pl b/misc/migration_tools/22_to_30/export_Authorities.pl index 2b0925f273..8327cf7805 100755 --- a/misc/migration_tools/22_to_30/export_Authorities.pl +++ b/misc/migration_tools/22_to_30/export_Authorities.pl @@ -1,4 +1,10 @@ #!/usr/bin/perl +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../../kohalib.pl" }; +} use C4::Context; #use MARC::File::XML(BinaryEncoding=>"utf8"); #use MARC::File::USMARC; 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 24dacad5ae..635a4145f8 100755 --- a/misc/migration_tools/22_to_30/export_Authorities_xml.pl +++ b/misc/migration_tools/22_to_30/export_Authorities_xml.pl @@ -1,4 +1,10 @@ #!/usr/bin/perl +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../../kohalib.pl" }; +} use C4::Context; use MARC::File::XML(BinaryEncoding=>"utf8"); use MARC::Record; diff --git a/misc/migration_tools/22_to_30/missing090field.pl b/misc/migration_tools/22_to_30/missing090field.pl index 5c8cb21247..218ce8b5fe 100755 --- a/misc/migration_tools/22_to_30/missing090field.pl +++ b/misc/migration_tools/22_to_30/missing090field.pl @@ -3,6 +3,12 @@ # Written by TG on 01/10/2005 # Revised by Joshua Ferraro on 03/31/2006 use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../../kohalib.pl" }; +} # Koha modules used diff --git a/misc/migration_tools/22_to_30/move_marc_to_authheader.pl b/misc/migration_tools/22_to_30/move_marc_to_authheader.pl index 6ecaf2730a..deffc7090d 100755 --- a/misc/migration_tools/22_to_30/move_marc_to_authheader.pl +++ b/misc/migration_tools/22_to_30/move_marc_to_authheader.pl @@ -2,7 +2,12 @@ # script to shift marc to biblioitems # scraped from updatedatabase for dev week by chris@katipo.co.nz - +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../../kohalib.pl" }; +} use C4::Context; use C4::AuthoritiesMarc; use MARC::Record; 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 db1665f9da..2cca920631 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 @@ -2,7 +2,12 @@ # script to shift marc to biblioitems # scraped from updatedatabase for dev week by chris@katipo.co.nz - +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../../kohalib.pl" }; +} use C4::Context; use C4::Biblio; use MARC::Record; @@ -137,4 +142,4 @@ sub LocalMARCgetbiblio { } } return $record; -} \ No newline at end of file +} diff --git a/misc/migration_tools/22_to_30/rebuild_leader.pl b/misc/migration_tools/22_to_30/rebuild_leader.pl index 7a0b7896ab..0ab0f07cf6 100755 --- a/misc/migration_tools/22_to_30/rebuild_leader.pl +++ b/misc/migration_tools/22_to_30/rebuild_leader.pl @@ -3,6 +3,12 @@ # Written by TG on 01/10/2005 # Revised by Joshua Ferraro on 03/31/2006 use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../../kohalib.pl" }; +} # Koha modules used diff --git a/misc/migration_tools/22_to_30/rebuild_unimarc_100.pl b/misc/migration_tools/22_to_30/rebuild_unimarc_100.pl index e428d6107a..60b1b878fe 100755 --- a/misc/migration_tools/22_to_30/rebuild_unimarc_100.pl +++ b/misc/migration_tools/22_to_30/rebuild_unimarc_100.pl @@ -3,6 +3,12 @@ # Written by TG on 01/10/2005 # Revised by Joshua Ferraro on 03/31/2006 use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../../kohalib.pl" }; +} # Koha modules used diff --git a/misc/migration_tools/bulkmarcimport.pl b/misc/migration_tools/bulkmarcimport.pl index 254dca0e50..e22e7aeab4 100755 --- a/misc/migration_tools/bulkmarcimport.pl +++ b/misc/migration_tools/bulkmarcimport.pl @@ -3,6 +3,12 @@ use strict; # use warnings; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} # Koha modules used use MARC::File::USMARC; diff --git a/misc/missing090field.pl b/misc/missing090field.pl index e0552e3e0b..dfeb0aa89a 100755 --- a/misc/missing090field.pl +++ b/misc/missing090field.pl @@ -3,6 +3,12 @@ # Written by TG on 01/10/2005 # Revised by Joshua Ferraro on 03/31/2006 use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} # Koha modules used diff --git a/misc/rebuild_marc_newframework.pl b/misc/rebuild_marc_newframework.pl index d8dcdc01aa..dcb797d721 100755 --- a/misc/rebuild_marc_newframework.pl +++ b/misc/rebuild_marc_newframework.pl @@ -11,6 +11,12 @@ use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} use C4::Context; use C4::Biblio; diff --git a/misc/rebuildnonmarc.pl b/misc/rebuildnonmarc.pl index 714cfddffb..16fbb68c85 100755 --- a/misc/rebuildnonmarc.pl +++ b/misc/rebuildnonmarc.pl @@ -2,6 +2,12 @@ # small script that rebuilds the non-MARC DB use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} # Koha modules used # use MARC::File::USMARC; diff --git a/misc/spellcheck_suggest/make_spellcheck_suggest.pl b/misc/spellcheck_suggest/make_spellcheck_suggest.pl index b828e81181..96ffea8ff3 100755 --- a/misc/spellcheck_suggest/make_spellcheck_suggest.pl +++ b/misc/spellcheck_suggest/make_spellcheck_suggest.pl @@ -16,8 +16,6 @@ ## CONFIGURABLE VARIABLES #################### ## - # Change this to where your Koha modules are (C4 directory) -use lib '/usr/local/koha/intranet/modules/'; # These are the tags that have meaningful data # for the databases I've worked with (MARC21 only) # you may need to change them depending on your data @@ -71,6 +69,12 @@ my @tags=( ); ## Leave this next bit alone use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/../kohalib.pl" }; +} use C4::Context; ## # SUGGEST DATABASE INFO diff --git a/misc/stage_biblios_file.pl b/misc/stage_biblios_file.pl index a741990ce9..bfe26ce972 100755 --- a/misc/stage_biblios_file.pl +++ b/misc/stage_biblios_file.pl @@ -1,6 +1,12 @@ #!/usr/bin/perl use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} use C4::Context; use C4::ImportBatch; diff --git a/misc/sync_koha_plugin.pl b/misc/sync_koha_plugin.pl index b683533b22..3aaaada437 100755 --- a/misc/sync_koha_plugin.pl +++ b/misc/sync_koha_plugin.pl @@ -1,6 +1,12 @@ #!/usr/bin/perl -w use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} use C4::Context; use Getopt::Long; diff --git a/misc/xmlintobiblioitems.pl b/misc/xmlintobiblioitems.pl index d302fd3a09..0ec2e202b4 100755 --- a/misc/xmlintobiblioitems.pl +++ b/misc/xmlintobiblioitems.pl @@ -2,6 +2,12 @@ # script that correct the marcxml from in biblioitems # Written by TG on 10/04/2006 use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} # Koha modules used @@ -37,4 +43,4 @@ $dbh->do("UNLOCK TABLES "); $timeneeded = gettimeofday - $starttime ; print "$i records in $timeneeded s\n" ; -END; \ No newline at end of file +END; diff --git a/misc/zebraqueue_daemon.pl b/misc/zebraqueue_daemon.pl index 7a9c8d5a44..88b6a6d6b5 100755 --- a/misc/zebraqueue_daemon.pl +++ b/misc/zebraqueue_daemon.pl @@ -3,6 +3,12 @@ # daemon to watch the zebraqueue and update zebra as needed use strict; +BEGIN { + # find Koha's Perl modules + # test carefully before changing this + use FindBin; + eval { require "$FindBin::Bin/kohalib.pl" }; +} use POE qw(Wheel::SocketFactory Wheel::ReadWrite Filter::Stream Driver::SysRW); use Unix::Syslog qw(:macros); -- 2.39.5