Koha-clms/t/db_dependent
Jonathan Druart 9d6d641d1f Bug 17600: Standardize our EXPORT_OK
On bug 17591 we discovered that there was something weird going on with
the way we export and use subroutines/modules.
This patch tries to standardize our EXPORT to use EXPORT_OK only.

That way we will need to explicitely define the subroutine we want to
use from a module.

This patch is a squashed version of:
Bug 17600: After export.pl
Bug 17600: After perlimport
Bug 17600: Manual changes
Bug 17600: Other manual changes after second perlimports run
Bug 17600: Fix tests

And a lot of other manual changes.

export.pl is a dirty script that can be found on bug 17600.

"perlimport" is:
git clone https://github.com/oalders/App-perlimports.git
cd App-perlimports/
cpanm --installdeps .
export PERL5LIB="$PERL5LIB:/kohadevbox/koha/App-perlimports/lib"
find . \( -name "*.pl" -o -name "*.pm" \) -exec perl App-perlimports/script/perlimports --inplace-edit --no-preserve-unused --filename {} \;

The ideas of this patch are to:
* use EXPORT_OK instead of EXPORT
* perltidy the EXPORT_OK list
* remove '&' before the subroutine names
* remove some uneeded use statements
* explicitely import the subroutines we need within the controllers or
modules

Note that the private subroutines (starting with _) should not be
exported (and not used from outside of the module except from tests).

EXPORT vs EXPORT_OK (from
https://www.thegeekstuff.com/2010/06/perl-exporter-examples/)
"""
Export allows to export the functions and variables of modules to user’s namespace using the standard import method. This way, we don’t need to create the objects for the modules to access it’s members.

@EXPORT and @EXPORT_OK are the two main variables used during export operation.

@EXPORT contains list of symbols (subroutines and variables) of the module to be exported into the caller namespace.

@EXPORT_OK does export of symbols on demand basis.
"""

If this patch caused a conflict with a patch you wrote prior to its
push:
* Make sure you are not reintroducing a "use" statement that has been
removed
* "$subroutine" is not exported by the C4::$MODULE module
means that you need to add the subroutine to the @EXPORT_OK list
* Bareword "$subroutine" not allowed while "strict subs"
means that you didn't imported the subroutine from the module:
  - use $MODULE qw( $subroutine list );
You can also use the fully qualified namespace: C4::$MODULE::$subroutine

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-07-16 08:58:47 +02:00
..
Acquisition Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Auth Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
AuthoritiesMarc
…
Authority Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Biblio Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Circulation Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
CourseReserves Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Creators Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Exporter Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Holds Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Illrequest
…
Items Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Koha Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
LDAP
…
Labels Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Letters Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Members Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
OAI Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Patron Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Record Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Reports Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Reserves Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
SIP Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Search Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Serials Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Template/Plugin Bug 24154: (follow-up) Make parameter and variable more explicit, add tests 2021-05-10 10:27:53 +02:00
Utils Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
api/v1 Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
cronjobs
…
data Bug 27968: Fix framework import if isurl has an incorrect value 2021-04-23 10:03:30 +02:00
misc/translator
…
selenium Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
www Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
00-strict.t Bug 28606: Remove $DEBUG and $ENV{DEBUG} 2021-06-24 11:53:44 +02:00
01-test_dbic.t
…
Accounts.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Acquisition.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Amazon.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ArticleRequests.t
…
AudioAlerts.t
…
Auth.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
AuthUtils.t
…
Auth_with_cas.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Auth_with_ldap.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
AuthorisedValues.t
…
AuthoritiesMarc.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
BackgroundJob.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Barcodes.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Barcodes_ValueBuilder.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Biblio.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Breeding.t
…
Budgets.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Cache.t
…
Calendar.t
…
Charset.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Circulation.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Clubs.t
…
Context.t Bug 28606: Remove $DEBUG and $ENV{DEBUG} 2021-06-24 11:53:44 +02:00
Contract.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
CourseReserves.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
DecreaseLoanHighHolds.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Filter_MARC_ViewPolicy.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Fines.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
FrameworkPlugin.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Heading.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Heading_MARC21.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Hold.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Holds.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
HoldsQueue.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Holidays.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ILSDI_Services.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Illcomments.t
…
Illrequestattributes.t
…
Illrequests.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ImportBatch.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ImportExportFramework.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Installer.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Items.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Koha.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Koha_Authority.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Koha_Database.t
…
Koha_Elasticsearch.t
…
Koha_ExternalContent_OverDrive.t
…
Koha_ExternalContent_RecordedBooks.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Koha_Misc_Files.t
…
Languages.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Letters.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
LibraryGroups.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Linker_Default.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Linker_FirstMatch.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Log.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
MarcModificationTemplates.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Members.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Message.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
MungeMarcPrice.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Overdues.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Passwordrecovery.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
PatronLists.t
…
Patroncards.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Patrons.t
…
Record.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
RecordProcessor_EmbedSeeFromHeadings.t
…
Reports.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Reserves.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
RotatingCollections.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Search.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Serials.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Serials_2.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Service.t
…
ShelfBrowser.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Sitemapper.t
…
Stats.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
StockRotationItems.t
…
StockRotationRotas.t
…
StockRotationStages.t
…
SuggestionEngine_ExplodedTerms.t
…
Suggestions.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
TablesSettings.t
…
Tags.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Templates.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
TestBuilder.t Bug 28479: Use primary keys to check object existence in TestBuilder 2021-06-21 12:07:28 +02:00
Upload.t Bug 28123: Fix expected value in unit test 2021-04-16 12:28:18 +02:00
UsageStats.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
Virtualshelves.t
…
XISBN.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
XSLT.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
check_kohastructure.t
…
check_sysprefs.t
…
db_structure.t
…
rollingloans.t Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
sysprefs.t
…
yaml.t
…
zebra_config.pl Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00