From aeabb610b89b8d0decab864f048d400acac28d6c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 9 Nov 2016 12:06:44 +0000 Subject: [PATCH] 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. There are still a lot of things to do, it would be good to write a script to do what's need to be done. --- C4/Auth.pm | 14 +++-- C4/Auth_with_cas.pm | 5 +- C4/Auth_with_ldap.pm | 6 +- C4/Auth_with_shibboleth.pm | 6 +- C4/Barcodes.pm | 7 --- C4/Biblio.pm | 12 ++-- C4/Breeding.pm | 5 +- C4/Charset.pm | 5 +- C4/Circulation.pm | 91 +++++++++++++----------------- C4/ClassSortRoutine.pm | 18 +++--- C4/ClassSource.pm | 29 +++++----- C4/CourseReserves.pm | 6 +- C4/External/BakerTaylor.pm | 11 ++-- C4/HoldsQueue.pm | 2 +- C4/ImportBatch.pm | 5 +- C4/ImportExportFramework.pm | 5 +- C4/InstallAuth.pm | 15 ++--- C4/Items.pm | 6 +- C4/Koha.pm | 16 +++--- C4/Languages.pm | 8 +-- C4/Letters.pm | 5 +- C4/Members.pm | 11 ++-- C4/Members/Statistics.pm | 4 +- C4/Output.pm | 22 ++++---- C4/Overdues.pm | 9 +-- C4/Reports.pm | 4 +- C4/Reports/Guided.pm | 4 +- C4/Reserves.pm | 8 +-- C4/SIP/Sip/Checksum.pm | 9 ++- C4/Scheduler.pm | 4 +- C4/Search.pm | 27 ++++----- C4/Serials.pm | 5 +- C4/ShelfBrowser.pm | 7 +-- C4/Tags.pm | 4 +- C4/TmplTokenType.pm | 31 +++++----- C4/XISBN.pm | 5 +- Koha/AuthUtils.pm | 9 ++- Koha/EDI.pm | 2 +- Koha/Item/Search/Field.pm | 22 +++++--- Koha/Patron/Password/Recovery.pm | 5 +- Koha/SimpleMARC.pm | 40 ++++++------- Koha/Util/FrameworkPlugin.pm | 8 --- Koha/pdfformat/layout2pagesde.pm | 9 ++- misc/translator/TmplTokenizer.pm | 5 -- misc/translator/VerboseWarnings.pm | 34 +++++------ t/db_dependent/Members/IssueSlip.t | 4 +- 46 files changed, 261 insertions(+), 308 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index f281def2ce0..b54bf1ef39b 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -26,7 +26,6 @@ use JSON qw/encode_json/; use URI::Escape; use CGI::Session; -require Exporter; use C4::Context; use C4::Templates; # to get the template use C4::Languages; @@ -50,8 +49,8 @@ use Net::CIDR; use C4::Log qw/logaction/; # use utf8; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug $ldap $cas $caslogout); - +use vars qw($debug $ldap $cas $caslogout); +our (@ISA, @EXPORT_OK); BEGIN { sub psgi_env { any { /^psgi\./ } keys %ENV } @@ -63,12 +62,15 @@ BEGIN { C4::Context->set_remote_address; $debug = $ENV{DEBUG}; - @ISA = qw(Exporter); - @EXPORT = qw(&checkauth &get_template_and_user &haspermission &get_user_subpermissions); + require Exporter; + @ISA = qw(Exporter); + @EXPORT_OK = qw(&check_api_auth &get_session &check_cookie_auth &checkpw &checkpw_internal &checkpw_hash &get_all_subpermissions &get_user_subpermissions track_login_daily &in_iprange + &get_template_and_user ); - %EXPORT_TAGS = ( EditPermissions => [qw(get_all_subpermissions get_user_subpermissions)] ); + + $debug = $ENV{DEBUG}; $ldap = C4::Context->config('useldapserver') || 0; $cas = C4::Context->preference('casAuthentication'); $caslogout = C4::Context->preference('casLogout'); diff --git a/C4/Auth_with_cas.pm b/C4/Auth_with_cas.pm index 4a6d0557d00..6eed3967c74 100644 --- a/C4/Auth_with_cas.pm +++ b/C4/Auth_with_cas.pm @@ -29,13 +29,14 @@ use FindBin; use YAML::XS; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug); +use vars qw($debug); +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; $debug = $ENV{DEBUG}; @ISA = qw(Exporter); - @EXPORT = qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required); + @EXPORT_OK = qw(check_api_auth_cas checkpw_cas login_cas logout_cas login_cas_url logout_if_required); } my $defaultcasserver; my $casservers; diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm index 679c0451414..e5f63bcd33a 100644 --- a/C4/Auth_with_ldap.pm +++ b/C4/Auth_with_ldap.pm @@ -30,12 +30,12 @@ use List::MoreUtils qw( any ); use Net::LDAP; use Net::LDAP::Filter; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug); - +use vars qw($debug); +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT = qw( checkpw_ldap ); + @EXPORT_OK = qw( checkpw_ldap ); } # Redefine checkpw_ldap: diff --git a/C4/Auth_with_shibboleth.pm b/C4/Auth_with_shibboleth.pm index 0f11d353ef0..e037a04b766 100644 --- a/C4/Auth_with_shibboleth.pm +++ b/C4/Auth_with_shibboleth.pm @@ -29,13 +29,13 @@ use Carp; use CGI; use List::MoreUtils qw(any); -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug); - +use vars qw($debug); +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; $debug = $ENV{DEBUG}; @ISA = qw(Exporter); - @EXPORT = + @EXPORT_OK = qw(shib_ok logout_shib login_shib_url checkpw_shib get_login_shib); } diff --git a/C4/Barcodes.pm b/C4/Barcodes.pm index 256a177680a..dfc78bec302 100644 --- a/C4/Barcodes.pm +++ b/C4/Barcodes.pm @@ -29,16 +29,9 @@ use C4::Barcodes::annual; use C4::Barcodes::incremental; use C4::Barcodes::EAN13; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); use vars qw($debug $cgi_debug); # from C4::Debug, of course use vars qw($max $prefformat); -BEGIN { - require Exporter; - @ISA = qw(Exporter); - @EXPORT_OK = qw(); -} - sub _prefformat { unless (defined $prefformat) { unless ($prefformat = C4::Context->preference('autoBarcode')) { diff --git a/C4/Biblio.pm b/C4/Biblio.pm index d341e8f6c02..6382b30c4d7 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -21,12 +21,12 @@ package C4::Biblio; use Modern::Perl; -use vars qw(@ISA @EXPORT); +use vars qw(@ISA @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT = qw( + @EXPORT_OK = qw( AddBiblio GetBiblioData GetMarcBiblio @@ -69,7 +69,7 @@ BEGIN { # those functions are exported but should not be used # they are useful in a few circumstances, so they are exported, # but don't use them unless you are a core developer ;-) - push @EXPORT, qw( + push @EXPORT_OK, qw( ModBiblioMarc ); } @@ -88,11 +88,12 @@ use Module::Load::Conditional qw(can_load); use C4::Koha; use C4::Log; # logaction use C4::Budgets; -use C4::ClassSource; -use C4::Charset; +use C4::ClassSource qw( GetClassSort ); +use C4::Charset qw( SetUTF8Flag ); use C4::Linker; use C4::OAI::Sets; use C4::Debug; +use C4::Items; use Koha::Caches; use Koha::Authority::Types; @@ -108,7 +109,6 @@ use Koha::Util::MARC; use vars qw($debug $cgi_debug); - =head1 NAME C4::Biblio - cataloging management functions diff --git a/C4/Breeding.pm b/C4/Breeding.pm index 6b103b3cdbd..0fe39bf99c0 100644 --- a/C4/Breeding.pm +++ b/C4/Breeding.pm @@ -32,12 +32,11 @@ use C4::Languages; use Koha::Database; use Koha::XSLT::Base; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT = qw(&BreedingSearch &Z3950Search &Z3950SearchAuth); + @EXPORT_OK = qw(&BreedingSearch &Z3950Search &Z3950SearchAuth); } =head1 NAME diff --git a/C4/Charset.pm b/C4/Charset.pm index c6e36a13071..acf7efc1c51 100644 --- a/C4/Charset.pm +++ b/C4/Charset.pm @@ -26,12 +26,11 @@ use C4::Debug; use Unicode::Normalize; use Encode qw( decode encode is_utf8 ); -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT = qw( + @EXPORT_OK = qw( NormalizeString IsStringUTF8ish MarcToUTF8Record diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 10db0d226aa..9f0e82e5de1 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -76,58 +76,47 @@ use Date::Calc qw( Day_of_Week Add_Delta_Days ); -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - +our (@ISA, @EXPORT_OK); BEGIN { - require Exporter; - @ISA = qw(Exporter); - - # FIXME subs that should probably be elsewhere - push @EXPORT, qw( - &barcodedecode - &LostItem - &ReturnLostItem - &GetPendingOnSiteCheckouts - ); - - # subs to deal with issuing a book - push @EXPORT, qw( - &CanBookBeIssued - &CanBookBeRenewed - &AddIssue - &AddRenewal - &GetRenewCount - &GetSoonestRenewDate - &GetLatestAutoRenewDate - &GetIssuingCharges - &GetBranchBorrowerCircRule - &GetBranchItemRule - &GetOpenIssue - &CheckIfIssuedToPatron - &IsItemIssued - GetTopIssues - ); - - # subs to deal with returns - push @EXPORT, qw( - &AddReturn - &MarkIssueReturned - ); - - # subs to deal with transfers - push @EXPORT, qw( - &transferbook - &GetTransfers - &GetTransfersFromTo - &updateWrongTransfer - &IsBranchTransferAllowed - &CreateBranchTransferLimit - &DeleteBranchTransferLimits - &TransferSlip - ); - - # subs to deal with offline circulation - push @EXPORT, qw( + + require Exporter; + @ISA = qw(Exporter); + + # FIXME subs that should probably be elsewhere + push @EXPORT_OK, qw( + &barcodedecode + &LostItem + &ReturnLostItem + &GetPendingOnSiteCheckouts + + &CanBookBeIssued + &CanBookBeRenewed + &AddIssue + &AddRenewal + &GetRenewCount + &GetSoonestRenewDate + &GetLatestAutoRenewDate + &GetIssuingCharges + &GetBranchBorrowerCircRule + &GetBranchItemRule + &GetBiblioIssues + &GetOpenIssue + &CheckIfIssuedToPatron + &IsItemIssued + GetTopIssues + + &AddReturn + &MarkIssueReturned + + &transferbook + &GetTransfers + &GetTransfersFromTo + &updateWrongTransfer + &IsBranchTransferAllowed + &CreateBranchTransferLimit + &DeleteBranchTransferLimits + &TransferSlip + &GetOfflineOperations &GetOfflineOperation &AddOfflineOperation diff --git a/C4/ClassSortRoutine.pm b/C4/ClassSortRoutine.pm index 77826cff1bd..3d8372fd8dc 100644 --- a/C4/ClassSortRoutine.pm +++ b/C4/ClassSortRoutine.pm @@ -20,12 +20,18 @@ package C4::ClassSortRoutine; use strict; use warnings; -require Exporter; use Class::Factory::Util; use C4::Context; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - +our (@ISA, @EXPORT_OK); +BEGIN { + require Exporter; + @ISA = qw(Exporter); + @EXPORT_OK = qw( + &GetSortRoutineNames + &GetClassSortKey + ); +} =head1 NAME @@ -40,12 +46,6 @@ use C4::ClassSortRoutine; =cut -@ISA = qw(Exporter); -@EXPORT = qw( - &GetSortRoutineNames - &GetClassSortKey -); - # initialization code my %loaded_routines = (); my @sort_routines = GetSortRoutineNames(); diff --git a/C4/ClassSource.pm b/C4/ClassSource.pm index 8c133bce704..a1f84219c38 100644 --- a/C4/ClassSource.pm +++ b/C4/ClassSource.pm @@ -20,12 +20,20 @@ package C4::ClassSource; use strict; use warnings; -require Exporter; use C4::Context; -use C4::ClassSortRoutine; - -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - +use C4::ClassSortRoutine qw( GetClassSortKey ); + +our (@ISA, @EXPORT_OK); +BEGIN { + require Exporter; + @ISA = qw(Exporter); + @EXPORT_OK = qw( + &GetClassSources + &GetClassSource + &GetClassSortRule + &GetClassSort + ); +} =head1 NAME @@ -44,17 +52,6 @@ sources and sorting rules. =cut - -@ISA = qw(Exporter); -@EXPORT = qw( - &GetClassSources - &GetClassSource - &GetClassSortRule - - &GetClassSort - -); - =head2 GetClassSources my $sources = GetClassSources(); diff --git a/C4/CourseReserves.pm b/C4/CourseReserves.pm index 1c08ad4d5e3..5e8c667a0d9 100644 --- a/C4/CourseReserves.pm +++ b/C4/CourseReserves.pm @@ -27,8 +27,8 @@ use Koha::Course::Instructors; use Koha::Course::Items; use Koha::Course::Reserves; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG @FIELDS); - +use vars qw($DEBUG @FIELDS); +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); @@ -53,7 +53,7 @@ BEGIN { &GetItemCourseReservesInfo ); - %EXPORT_TAGS = ( 'all' => \@EXPORT_OK ); + #%EXPORT_TAGS = ( 'all' => \@EXPORT_OK ); $DEBUG = 0; @FIELDS = ( 'itype', 'ccode', 'homebranch', 'holdingbranch', 'location' ); diff --git a/C4/External/BakerTaylor.pm b/C4/External/BakerTaylor.pm index dbb307cab9f..4060ac526c4 100644 --- a/C4/External/BakerTaylor.pm +++ b/C4/External/BakerTaylor.pm @@ -27,14 +27,15 @@ use C4::Debug; use Modern::Perl; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION); +use vars qw(%EXPORT_TAGS $VERSION); +our (@ISA, @EXPORT_OK); BEGIN { - require Exporter; - @ISA = qw(Exporter); + require Exporter; + @ISA = qw(Exporter); $VERSION = 3.07.00.049; - @EXPORT_OK = qw(&availability &content_cafe &image_url &link_url &http_jacket_link); - %EXPORT_TAGS = (all=>\@EXPORT_OK); + @EXPORT_OK = qw(&availability &content_cafe &image_url &link_url &http_jacket_link); +# %EXPORT_TAGS = (all=>\@EXPORT_OK); } # These variables are plack safe: they are initialized each time diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm index 3774214527e..03331a39145 100644 --- a/C4/HoldsQueue.pm +++ b/C4/HoldsQueue.pm @@ -37,7 +37,7 @@ use List::Util qw(shuffle); use List::MoreUtils qw(any); use Data::Dumper; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm index 2a5696d5132..4e9ff64de8e 100644 --- a/C4/ImportBatch.pm +++ b/C4/ImportBatch.pm @@ -31,12 +31,11 @@ use Koha::Items; use Koha::Plugins::Handler; use Koha::Logger; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT = qw( + @EXPORT_OK = qw( GetZ3950BatchId GetWebserviceBatchId GetImportRecordMarc diff --git a/C4/ImportExportFramework.pm b/C4/ImportExportFramework.pm index 9352dad201d..15cf542be4d 100644 --- a/C4/ImportExportFramework.pm +++ b/C4/ImportExportFramework.pm @@ -30,12 +30,11 @@ use C4::Context; use C4::Debug; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT = qw( + @EXPORT_OK = qw( &ExportFramework &ImportFramework &createODS diff --git a/C4/InstallAuth.pm b/C4/InstallAuth.pm index c3f5adcaa13..fe1eab57cda 100644 --- a/C4/InstallAuth.pm +++ b/C4/InstallAuth.pm @@ -29,13 +29,14 @@ use C4::Output; use C4::Templates; use C4::Koha; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - -@ISA = qw(Exporter); -@EXPORT = qw( - &checkauth - &get_template_and_user -); +our (@ISA, @EXPORT_OK); +BEGIN { + @ISA = qw(Exporter); + @EXPORT_OK = qw( + &checkauth + &get_template_and_user + ); +} =head1 NAME diff --git a/C4/Items.pm b/C4/Items.pm index 1f0d560e86e..f537f6c6925 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -20,12 +20,12 @@ package C4::Items; use Modern::Perl; -use vars qw(@ISA @EXPORT); +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT = qw( + @EXPORT_OK = qw( AddItemFromMarc AddItemBatchFromMarc ModItemFromMarc @@ -51,7 +51,7 @@ use Carp; use Try::Tiny; use C4::Context; use C4::Koha; -use C4::Biblio; +use C4::Biblio qw( GetFrameworkCode ); use Koha::DateUtils; use MARC::Record; use C4::ClassSource; diff --git a/C4/Koha.pm b/C4/Koha.pm index c08ee6ad448..508caa432af 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -30,12 +30,11 @@ use Koha::MarcSubfieldStructures; use Business::ISBN; use Business::ISSN; use autouse 'Data::cselectall_arrayref' => qw(Dumper); -use vars qw(@ISA @EXPORT @EXPORT_OK $DEBUG); - +our (@ISA, @EXPORT_OK); BEGIN { - require Exporter; - @ISA = qw(Exporter); - @EXPORT = qw( + require Exporter; + @ISA = qw(Exporter); + @EXPORT_OK = qw( &GetItemTypesCategorized &getallthemes &getFacets @@ -57,9 +56,9 @@ BEGIN { &GetVariationsOfISSNs &NormalizeISSN - $DEBUG - ); - $DEBUG = 0; + GetDailyQuote + + ); } =head1 NAME @@ -249,7 +248,6 @@ sub getImageSets { my @imagesets = (); # list of hasrefs of image set data to pass to template my @subdirectories = _getSubdirectoryNames( $paths->{'staff'}{'filesystem'} ); foreach my $imagesubdir ( @subdirectories ) { - warn $imagesubdir if $DEBUG; my @imagelist = (); # hashrefs of image info my @imagenames = _getImagesFromDirectory( File::Spec->catfile( $paths->{'staff'}{'filesystem'}, $imagesubdir ) ); my $imagesetactive = 0; diff --git a/C4/Languages.pm b/C4/Languages.pm index 8042bcdf3f1..a5a73897e5f 100644 --- a/C4/Languages.pm +++ b/C4/Languages.pm @@ -28,18 +28,18 @@ use List::MoreUtils qw( any ); use C4::Context; use Koha::Caches; use Koha::Cache::Memory::Lite; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG); - +use vars qw($DEBUG); +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT = qw( + @EXPORT_OK = qw( &getFrameworkLanguages &getTranslatedLanguages &getLanguages &getAllLanguages ); - @EXPORT_OK = qw(getFrameworkLanguages getTranslatedLanguages getAllLanguages getLanguages get_bidi regex_lang_subtags language_get_description accept_language getlanguage); + push @EXPORT_OK, qw(getFrameworkLanguages getTranslatedLanguages getAllLanguages getLanguages get_bidi regex_lang_subtags language_get_description accept_language getlanguage); $DEBUG = 0; } diff --git a/C4/Letters.pm b/C4/Letters.pm index 99768ed656e..8f1bdccf975 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -44,12 +44,11 @@ use Koha::Patrons; use Koha::SMTP::Servers; use Koha::Subscriptions; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT = qw( + @EXPORT_OK = qw( &EnqueueLetter &GetLetters &GetLettersAvailableForALibrary &GetLetterTemplates &DelLetter &GetPreparedLetter &GetWrappedLetter &SendAlerts &GetPrintMessages &GetMessageTransportTypes ); } diff --git a/C4/Members.pm b/C4/Members.pm index c52f18add85..c2338259e55 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -44,24 +44,23 @@ use Koha::List::Patron; use Koha::Patrons; use Koha::Patron::Categories; -our (@ISA,@EXPORT,@EXPORT_OK,$debug); +our ($debug); +our (@ISA, @EXPORT_OK); BEGIN { $debug = $ENV{DEBUG} || 0; require Exporter; @ISA = qw(Exporter); - #Get data - push @EXPORT, qw( + @EXPORT_OK = qw( + &GetMemberDetails + &GetMember &GetAllIssues &GetBorrowersToExpunge &IssueSlip - ); - #Check data - push @EXPORT, qw( &checkuserpassword &checkcardnumber ); diff --git a/C4/Members/Statistics.pm b/C4/Members/Statistics.pm index 4f640bad20e..6107d23f91d 100644 --- a/C4/Members/Statistics.pm +++ b/C4/Members/Statistics.pm @@ -26,14 +26,14 @@ use Modern::Perl; use C4::Context; -our ( @ISA, @EXPORT, @EXPORT_OK, $debug ); +our ( @ISA, @EXPORT_OK, $debug ); BEGIN { $debug = $ENV{DEBUG} || 0; require Exporter; @ISA = qw(Exporter); - push @EXPORT, qw( + @EXPORT_OK = qw( &GetTotalIssuesTodayByBorrower &GetTotalIssuesReturnedTodayByBorrower &GetPrecedentStateByBorrower diff --git a/C4/Output.pm b/C4/Output.pm index 8ea7bb51fa9..db6c755f7f6 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -34,26 +34,24 @@ use C4::Auth qw(get_template_and_user); use C4::Context; use C4::Templates; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; - @ISA = qw(Exporter); - @EXPORT_OK = qw(&is_ajax ajax_fail); # More stuff should go here instead - %EXPORT_TAGS = ( all =>[qw(setlanguagecookie pagination_bar parametrized_url - &output_with_http_headers &output_ajax_with_http_headers &output_html_with_http_headers)], - ajax =>[qw(&output_with_http_headers &output_ajax_with_http_headers is_ajax)], - html =>[qw(&output_with_http_headers &output_html_with_http_headers)] - ); - push @EXPORT, qw( + @ISA = qw(Exporter); + @EXPORT_OK, qw( + is_ajax + ajax_fail setlanguagecookie getlanguagecookie pagination_bar parametrized_url - ); - push @EXPORT, qw( &output_html_with_http_headers &output_ajax_with_http_headers &output_with_http_headers &output_and_exit_if_error &output_and_exit &output_error ); - +# %EXPORT_TAGS = ( all =>[qw(setlanguagecookie pagination_bar parametrized_url +# &output_with_http_headers &output_ajax_with_http_headers &output_html_with_http_headers)], +# ajax =>[qw(&output_with_http_headers &output_ajax_with_http_headers is_ajax)], +# html =>[qw(&output_with_http_headers &output_html_with_http_headers)] +# ); } =head1 NAME diff --git a/C4/Overdues.pm b/C4/Overdues.pm index faea77e0f34..b5b2f3c4a79 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -37,14 +37,13 @@ use Koha::Account::Lines; use Koha::Account::Offsets; use Koha::Libraries; -use vars qw(@ISA @EXPORT); - +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); # subs to rename (and maybe merge some...) - push @EXPORT, qw( + @EXPORT_OK = qw( &CalcFine &Getoverdues &checkoverdues @@ -54,10 +53,6 @@ BEGIN { &GetOverduesForBranch &GetOverdueMessageTransportTypes &parse_overdues_letter - ); - - # subs to move to Circulation.pm - push @EXPORT, qw( &GetIssuesIteminfo ); } diff --git a/C4/Reports.pm b/C4/Reports.pm index 33008446177..6ee3f322e1f 100644 --- a/C4/Reports.pm +++ b/C4/Reports.pm @@ -20,14 +20,14 @@ package C4::Reports; use Modern::Perl; use CGI qw ( -utf8 ); -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); use C4::Context; use C4::Debug; +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT = qw( + @EXPORT_OK = qw( GetDelimiterChoices ); } diff --git a/C4/Reports/Guided.pm b/C4/Reports/Guided.pm index 21627331dda..cc9fafd0613 100644 --- a/C4/Reports/Guided.pm +++ b/C4/Reports/Guided.pm @@ -22,7 +22,6 @@ use CGI qw ( -utf8 ); use Carp; use JSON qw( from_json ); -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); use C4::Context; use C4::Templates qw/themelanguage/; use C4::Koha; @@ -39,10 +38,11 @@ use Koha::AuthorisedValues; use Koha::Patron::Categories; use Koha::SharedContent; +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT = qw( + @EXPORT_OK = qw( get_report_types get_report_areas get_report_groups get_columns build_query get_criteria save_report get_saved_reports execute_query get_column_type get_distinct_values save_dictionary get_from_dictionary diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 8941d4f72c3..1020057f2e8 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -51,8 +51,6 @@ use Carp; use Data::Dumper; use List::MoreUtils qw( firstidx any ); -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - =head1 NAME C4::Reserves - Koha functions for dealing with reservation. @@ -99,10 +97,11 @@ This modules provides somes functions to deal with reservations. =cut +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT = qw( + @EXPORT_OK = qw( &AddReserve &GetReserveStatus @@ -140,8 +139,9 @@ BEGIN { IsItemOnHoldAndFound GetMaxPatronHoldsForRecord + + MergeHolds ); - @EXPORT_OK = qw( MergeHolds ); } =head2 AddReserve diff --git a/C4/SIP/Sip/Checksum.pm b/C4/SIP/Sip/Checksum.pm index c2b1e6b0df9..a4533e9f983 100644 --- a/C4/SIP/Sip/Checksum.pm +++ b/C4/SIP/Sip/Checksum.pm @@ -1,12 +1,15 @@ package C4::SIP::Sip::Checksum; -use Exporter; use strict; use warnings; -our @ISA = qw(Exporter); -our @EXPORT_OK = qw(checksum verify_cksum); +our (@ISA, @EXPORT_OK); our $debug = 0; +BEGIN { + require Exporter; + @ISA = qw(Exporter); + @EXPORT_OK = qw(checksum verify_cksum); +} sub checksum { my $pkt = shift; diff --git a/C4/Scheduler.pm b/C4/Scheduler.pm index a1c1ae557f9..ed6e49c8980 100644 --- a/C4/Scheduler.pm +++ b/C4/Scheduler.pm @@ -19,14 +19,14 @@ package C4::Scheduler; use Modern::Perl; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); use C4::Context; use Schedule::At; +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT = + @EXPORT_OK = qw(get_jobs get_at_jobs get_at_job add_at_job remove_at_job); } diff --git a/C4/Search.pm b/C4/Search.pm index 0db460a8083..f94412d5d3e 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -16,7 +16,6 @@ package C4::Search; # along with Koha; if not, see . use Modern::Perl; -require Exporter; use C4::Context; use C4::Biblio; # GetMarcFromKohaField, GetBiblioData use C4::Koha; # getFacets @@ -37,10 +36,23 @@ use URI::Escape; use Business::ISBN; use MARC::Record; use MARC::Field; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG); +use vars qw($DEBUG); +our (@ISA, @EXPORT_OK); BEGIN { $DEBUG = ($ENV{DEBUG}) ? 1 : 0; + + require Exporter; + @ISA = qw(Exporter); + @EXPORT_OK = qw( + &FindDuplicate + &SimpleSearch + &searchResults + &getRecords + &buildQuery + &GetDistinctValues + &enabled_staff_search_views + ); } =head1 NAME @@ -59,17 +71,6 @@ This module provides searching functions for Koha's bibliographic databases =cut -@ISA = qw(Exporter); -@EXPORT = qw( - &FindDuplicate - &SimpleSearch - &searchResults - &getRecords - &buildQuery - &GetDistinctValues - &enabled_staff_search_views -); - # make all your functions, whether exported or not; =head2 FindDuplicate diff --git a/C4/Serials.pm b/C4/Serials.pm index 709a24315ad..46bd8d12453 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -38,8 +38,6 @@ use Koha::Subscription::Histories; use Koha::SharedContent; use Scalar::Util qw( looks_like_number ); -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - # Define statuses use constant { EXPECTED => 1, @@ -62,10 +60,11 @@ use constant MISSING_STATUSES => ( MISSING_LOST ); +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT = qw( + @EXPORT_OK = qw( &NewSubscription &ModSubscription &DelSubscription &GetSubscription &CountSubscriptionFromBiblionumber &GetSubscriptionsFromBiblionumber &SearchSubscriptions diff --git a/C4/ShelfBrowser.pm b/C4/ShelfBrowser.pm index b115c935415..1eba444d96b 100644 --- a/C4/ShelfBrowser.pm +++ b/C4/ShelfBrowser.pm @@ -26,15 +26,12 @@ use C4::Koha; use Koha::Biblios; use Koha::Libraries; -use vars qw(@ISA @EXPORT @EXPORT_OK); - +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT = qw( - &GetNearbyItems - ); @EXPORT_OK = qw( + &GetNearbyItems ); } diff --git a/C4/Tags.pm b/C4/Tags.pm index a337a7ac20c..dc1ed90c897 100644 --- a/C4/Tags.pm +++ b/C4/Tags.pm @@ -30,8 +30,7 @@ use Module::Load::Conditional qw/check_install/; use constant TAG_FIELDS => qw(tag_id borrowernumber biblionumber term language date_created); use constant TAG_SELECT => "SELECT " . join(',', TAG_FIELDS) . "\n FROM tags_all\n"; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - +our (@ISA, @EXPORT_OK); BEGIN { @ISA = qw(Exporter); @EXPORT_OK = qw( @@ -49,7 +48,6 @@ BEGIN { &get_filters stratify_tags ); - # %EXPORT_TAGS = (); my $ext_dict = C4::Context->preference('TagsExternalDictionary'); if ( $ext_dict && ! check_install( module => 'Lingua::Ispell' ) ) { warn "Ignoring TagsExternalDictionary, because Lingua::Ispell is not installed."; diff --git a/C4/TmplTokenType.pm b/C4/TmplTokenType.pm index c8a5c96e890..e55366bfe21 100644 --- a/C4/TmplTokenType.pm +++ b/C4/TmplTokenType.pm @@ -20,8 +20,6 @@ package C4::TmplTokenType; use Modern::Perl; require Exporter; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - ############################################################################### =head1 NAME @@ -38,25 +36,28 @@ The predefined constants are ############################################################################### -@ISA = qw(Exporter); -@EXPORT_OK = qw( - &TEXT - &TEXT_PARAMETRIZED - &CDATA - &TAG - &DECL - &PI - &DIRECTIVE - &COMMENT - &UNKNOWN -); - ############################################################################### use vars qw( $_text $_text_parametrized $_cdata $_tag $_decl $_pi $_directive $_comment $_null $_unknown ); +our (@ISA, @EXPORT_OK); BEGIN { + + require Exporter; + @ISA = qw(Exporter); + @EXPORT_OK = qw( + &TEXT + &TEXT_PARAMETRIZED + &CDATA + &TAG + &DECL + &PI + &DIRECTIVE + &COMMENT + &UNKNOWN + ); + my $new = sub { my $this = 'C4::TmplTokenType';#shift; my $class = ref($this) || $this; diff --git a/C4/XISBN.pm b/C4/XISBN.pm index 65ef2878db1..214accdfbb1 100644 --- a/C4/XISBN.pm +++ b/C4/XISBN.pm @@ -31,12 +31,11 @@ use Koha::Biblios; use Koha::SearchEngine; use Koha::SearchEngine::Search; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT_OK = qw( + @EXPORT_OK = qw( &get_xisbns ); } diff --git a/Koha/AuthUtils.pm b/Koha/AuthUtils.pm index 3bf28ef73ad..2828833f698 100644 --- a/Koha/AuthUtils.pm +++ b/Koha/AuthUtils.pm @@ -27,10 +27,13 @@ use Koha::Exceptions::Password; use C4::Context; -use base 'Exporter'; - -our @EXPORT_OK = qw(hash_password get_script_name); +our (@ISA, @EXPORT_OK); +BEGIN { + require Exporter; + @ISA = qw(Exporter); + @EXPORT_OK = qw(hash_password get_script_name); +}; =head1 NAME Koha::AuthUtils - utility routines for authentication diff --git a/Koha/EDI.pm b/Koha/EDI.pm index 5857f4eff7f..5ea22bc15a4 100644 --- a/Koha/EDI.pm +++ b/Koha/EDI.pm @@ -41,7 +41,7 @@ use Koha::Acquisition::Baskets; use Koha::Acquisition::Booksellers; our $VERSION = 1.1; -our @EXPORT_OK = +push @EXPORT_OK, qw( process_quote process_invoice process_ordrsp create_edi_order get_edifact_ean ); sub create_edi_order { diff --git a/Koha/Item/Search/Field.pm b/Koha/Item/Search/Field.pm index 77e5309b302..c655949bb38 100644 --- a/Koha/Item/Search/Field.pm +++ b/Koha/Item/Search/Field.pm @@ -1,15 +1,19 @@ package Koha::Item::Search::Field; use Modern::Perl; -use base qw( Exporter ); - -our @EXPORT_OK = qw( - AddItemSearchField - ModItemSearchField - DelItemSearchField - GetItemSearchField - GetItemSearchFields -); + +our (@ISA, @EXPORT_OK); +BEGIN { + require Exporter + @ISA = qw(Exporter); + @EXPORT_OK, qw( + AddItemSearchField + ModItemSearchField + DelItemSearchField + GetItemSearchField + GetItemSearchFields + ); +}; use C4::Context; diff --git a/Koha/Patron/Password/Recovery.pm b/Koha/Patron/Password/Recovery.pm index c2e2d279300..b6b9c24453e 100644 --- a/Koha/Patron/Password/Recovery.pm +++ b/Koha/Patron/Password/Recovery.pm @@ -23,12 +23,11 @@ use C4::Letters; use Crypt::Eksblowfish::Bcrypt qw(en_base64); use Koha::DateUtils; -use vars qw(@ISA @EXPORT); - +our (@ISA, @EXPORT_OK); BEGIN { require Exporter; @ISA = qw(Exporter); - push @EXPORT, qw( + @EXPORT_OK = qw( &ValidateBorrowernumber &SendPasswordRecoveryEmail &GetValidLinkInfo diff --git a/Koha/SimpleMARC.pm b/Koha/SimpleMARC.pm index 8b2fc651c4d..05ed96a33b2 100644 --- a/Koha/SimpleMARC.pm +++ b/Koha/SimpleMARC.pm @@ -18,29 +18,23 @@ package Koha::SimpleMARC; use Modern::Perl; -#use MARC::Record; - -require Exporter; - -our @ISA = qw(Exporter); -our %EXPORT_TAGS = ( 'all' => [ qw( - -) ] ); - -our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); - -our @EXPORT = qw( - read_field - add_field - update_field - copy_field - copy_and_replace_field - move_field - delete_field - field_exists - field_equals -); - +our (@ISA, @EXPORT_OK); +BEGIN { + require Exporter; + our @ISA = qw(Exporter); + + @EXPORT_OK = qw( + read_field + add_field + update_field + copy_field + copy_and_replace_field + move_field + delete_field + field_exists + field_equals + ); +} our $debug = 0; diff --git a/Koha/Util/FrameworkPlugin.pm b/Koha/Util/FrameworkPlugin.pm index 9b29287c760..38434b8e9cf 100644 --- a/Koha/Util/FrameworkPlugin.pm +++ b/Koha/Util/FrameworkPlugin.pm @@ -22,14 +22,6 @@ package Koha::Util::FrameworkPlugin; use Modern::Perl; -our ( @ISA, @EXPORT, @EXPORT_OK ); -BEGIN { - require Exporter; - @ISA = qw( Exporter ); - @EXPORT = qw( ); - @EXPORT_OK = qw( wrapper date_entered ); -} - =head1 NAME Koha::Util::FrameworkPlugin - utility class with routines for framework plugins diff --git a/Koha/pdfformat/layout2pagesde.pm b/Koha/pdfformat/layout2pagesde.pm index d7d69126de4..5ce74a0c466 100644 --- a/Koha/pdfformat/layout2pagesde.pm +++ b/Koha/pdfformat/layout2pagesde.pm @@ -21,7 +21,6 @@ package Koha::pdfformat::layout2pagesde; # along with Koha; if not, see . #you can use any PDF::API2 module, all you need to do is return the stringifyed pdf object from the printpdf sub. -use vars qw(@ISA @EXPORT); use MIME::Base64; use Modern::Perl; use utf8; @@ -30,11 +29,11 @@ use Koha::Number::Price; use Koha::DateUtils; use Koha::Libraries; +our (@ISA, @EXPORT_OK); BEGIN { - use Exporter (); - our (@ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); - @ISA = qw(Exporter); - @EXPORT = qw(printpdf); + require Exporter; + @ISA = qw(Exporter); + @EXPORT_OK = qw(printpdf); } diff --git a/misc/translator/TmplTokenizer.pm b/misc/translator/TmplTokenizer.pm index 0598bc209df..05cc54ea6b6 100644 --- a/misc/translator/TmplTokenizer.pm +++ b/misc/translator/TmplTokenizer.pm @@ -7,8 +7,6 @@ use C4::TTParser; use VerboseWarnings qw( pedantic_p error_normal warn_normal warn_pedantic ); require Exporter; -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - ############################################################################### =head1 NAME @@ -24,9 +22,6 @@ A wrapper for the functionality found in TTParser to allow an easier transition ############################################################################### -@ISA = qw(Exporter); -@EXPORT_OK = qw(); - use vars qw( $pedantic_attribute_error_in_nonpedantic_mode_p ); use vars qw( $pedantic_tmpl_var_use_in_nonpedantic_mode_p ); use vars qw( $pedantic_error_markup_in_pcdata_p ); diff --git a/misc/translator/VerboseWarnings.pm b/misc/translator/VerboseWarnings.pm index 65281ffcb17..2324062b139 100644 --- a/misc/translator/VerboseWarnings.pm +++ b/misc/translator/VerboseWarnings.pm @@ -1,9 +1,6 @@ package VerboseWarnings; use Modern::Perl; -require Exporter; - -use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); ############################################################################### @@ -20,20 +17,23 @@ verbose warnings. ############################################################################### - -@ISA = qw(Exporter); -@EXPORT_OK = qw( - &pedantic_p - &warn_additional - &warn_normal - &warn_pedantic - &error_additional - &error_normal -); -%EXPORT_TAGS = ( - 'warn' => [ 'warn_additional', 'warn_normal', 'warn_pedantic' ], - 'die' => [ 'error_additional', 'error_normal' ], -); +our (@ISA, @EXPORT_OK); +BEGIN { + require Exporter; + @ISA = qw(Exporter); + @EXPORT_OK = qw( + &pedantic_p + &warn_additional + &warn_normal + &warn_pedantic + &error_additional + &error_normal + ); + %EXPORT_TAGS = ( + 'warn' => [ 'warn_additional', 'warn_normal', 'warn_pedantic' ], + 'die' => [ 'error_additional', 'error_normal' ], + ); +} ############################################################################### diff --git a/t/db_dependent/Members/IssueSlip.t b/t/db_dependent/Members/IssueSlip.t index 95867690a1f..cc2d3b6c506 100755 --- a/t/db_dependent/Members/IssueSlip.t +++ b/t/db_dependent/Members/IssueSlip.t @@ -25,8 +25,8 @@ use Test::MockTime qw( set_fixed_time ); use t::lib::TestBuilder; use C4::Circulation; -use C4::Biblio; -use C4::Items; +use C4::Biblio qw( AddBiblio ); +use C4::Items qw( AddItem ); use C4::Members; use Koha::DateUtils qw( dt_from_string output_pref ); -- 2.20.1