Bug 24000 - Some modules do not return 1
Summary: Some modules do not return 1
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low trivial (vote)
Assignee: James O'Keeffe
QA Contact: Testopia
URL:
Keywords: Academy
Depends on:
Blocks:
 
Reported: 2019-11-08 11:03 UTC by Marcel de Rooy
Modified: 2021-12-13 21:11 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.05


Attachments
Bug 24000: Koha::Item::Search::Field does not return 1 (709 bytes, patch)
2019-11-08 11:10 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 24000: Some modules do not return 1 (3.08 KB, patch)
2021-01-19 03:28 UTC, James O'Keeffe
Details | Diff | Splinter Review
Bug 24000: Koha::Item::Search::Field does not return 1 (718 bytes, patch)
2021-03-26 18:54 UTC, David Nind
Details | Diff | Splinter Review
Bug 24000: Some modules do not return 1 (2.83 KB, patch)
2021-03-26 18:54 UTC, David Nind
Details | Diff | Splinter Review
Bug 24000: Koha::Item::Search::Field does not return 1 (776 bytes, patch)
2021-03-27 14:25 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 24000: Some modules do not return 1 (2.89 KB, patch)
2021-03-27 14:25 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2019-11-08 11:03:33 UTC

    
Comment 1 Marcel de Rooy 2019-11-08 11:10:50 UTC
Created attachment 95199 [details] [review]
Bug 24000: Koha::Item::Search::Field does not return 1

Test plan:
Run t/db_dependent/Koha/Item/Search/Field.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 2 Marcel de Rooy 2019-11-08 11:11:35 UTC
Super trivial, signing off
Comment 3 Jonathan Druart 2019-11-13 11:41:50 UTC
Is it the only one?
Comment 4 Marcel de Rooy 2019-11-13 11:49:58 UTC
(In reply to Jonathan Druart from comment #3)
> Is it the only one?

IIRC you fixed several ones a few years ago?
I didnt look for it now. Just came across this one.
Comment 5 Jonathan Druart 2019-11-13 12:16:09 UTC
% perl -0777 -nlwE 'say $ARGV if !/\n1/i' **/*.pm                                                                                                                                                      
Koha/Filter/MARC/EmbedItemsAvailability.pm
Koha/Filter/MARC/EmbedSeeFromHeadings.pm
Koha/Filter/MARC/Null.pm
Koha/Item/Search/Field.pm
Koha/SearchEngine.pm
misc/translator/VerboseWarnings.pm
t/lib/Koha/Plugin/Test.pm

I think we should fix them all in one go.
Comment 6 Aleisha Amohia 2020-12-15 02:35:42 UTC
For the sake of learning and documentation, it'd be awesome to note here why it's important for modules to return 1 :)
Comment 7 David Cook 2020-12-15 05:21:30 UTC
(In reply to Aleisha Amohia from comment #6)
> For the sake of learning and documentation, it'd be awesome to note here why
> it's important for modules to return 1 :)

https://perldoc.perl.org/functions/require

"The file must return true as the last statement to indicate successful execution of any initialization code, so it's customary to end such a file with 1; unless you're sure it'll return true otherwise. But it's better just to put the 1;, in case you add more statements."
Comment 8 Katrin Fischer 2020-12-15 08:58:25 UTC
(In reply to Aleisha Amohia from comment #6)
> For the sake of learning and documentation, it'd be awesome to note here why
> it's important for modules to return 1 :)

+1 :) Thx for asking the question!
Comment 9 James O'Keeffe 2021-01-19 03:28:42 UTC
Created attachment 115290 [details] [review]
Bug 24000: Some modules do not return 1

This patch adds "1;" to the end of the following perl files:
Koha/Filter/MARC/EmbedItemsAvailability.pm
Koha/Filter/MARC/EmbedSeeFromHeadings.pm
Koha/Filter/MARC/Null.pm
Koha/Item/Search/Field.pm
Koha/SearchEngine.pm
misc/translator/VerboseWarnings.pm
t/lib/Koha/Plugin/Test.pm

This indicates the succesful execution of the initialization code.

Test plan:
Ensure that there are no other perl files that need "1;", but dont have
it.
Comment 10 David Nind 2021-03-26 18:54:13 UTC
Created attachment 118877 [details] [review]
Bug 24000: Koha::Item::Search::Field does not return 1

Test plan:
Run t/db_dependent/Koha/Item/Search/Field.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>
Comment 11 David Nind 2021-03-26 18:54:17 UTC
Created attachment 118878 [details] [review]
Bug 24000: Some modules do not return 1

This patch adds "1;" to the end of the following perl files:
Koha/Filter/MARC/EmbedItemsAvailability.pm
Koha/Filter/MARC/EmbedSeeFromHeadings.pm
Koha/Filter/MARC/Null.pm
Koha/Item/Search/Field.pm
Koha/SearchEngine.pm
misc/translator/VerboseWarnings.pm
t/lib/Koha/Plugin/Test.pm

This indicates the succesful execution of the initialization code.

Test plan:
Ensure that there are no other perl files that need "1;", but dont have
it.

Signed-off-by: David Nind <david@davidnind.com>
Comment 12 David Nind 2021-03-26 18:55:27 UTC
Tested by running prove t/db_dependent/Koha/Item/Search/Field.t before and after applying patches. Hope that is sufficient.
Comment 13 Katrin Fischer 2021-03-27 14:25:08 UTC
Created attachment 118891 [details] [review]
Bug 24000: Koha::Item::Search::Field does not return 1

Test plan:
Run t/db_dependent/Koha/Item/Search/Field.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 14 Katrin Fischer 2021-03-27 14:25:12 UTC
Created attachment 118892 [details] [review]
Bug 24000: Some modules do not return 1

This patch adds "1;" to the end of the following perl files:
Koha/Filter/MARC/EmbedItemsAvailability.pm
Koha/Filter/MARC/EmbedSeeFromHeadings.pm
Koha/Filter/MARC/Null.pm
Koha/Item/Search/Field.pm
Koha/SearchEngine.pm
misc/translator/VerboseWarnings.pm
t/lib/Koha/Plugin/Test.pm

This indicates the succesful execution of the initialization code.

Test plan:
Ensure that there are no other perl files that need "1;", but dont have
it.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 15 Jonathan Druart 2021-04-06 13:57:35 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 16 Fridolin Somers 2021-04-15 10:56:05 UTC
Pushed to 20.11.x for 20.11.05
Comment 17 Andrew Fuerste-Henry 2021-04-25 13:18:04 UTC
I'm getting a QA error with these patches for 20.05:
Processing files after patches
|========================>| 7 / 7 (100.00%)

 OK	Koha/Filter/MARC/EmbedItemsAvailability.pm
 FAIL	Koha/Filter/MARC/EmbedSeeFromHeadings.pm
   FAIL	  pod
		*** WARNING: 
		empty section in previous paragraph
		 
		 in file Koha/Filter/MARC/EmbedSeeFromHeadings.pm
		
		*** ERROR: 
		Spurious text after =cut
		 
		 in file Koha/Filter/MARC/EmbedSeeFromHeadings.pm
		

 FAIL	Koha/Filter/MARC/Null.pm
   FAIL	  pod
		*** WARNING: empty section in previous paragraph  in file Koha/Filter/MARC/Null.pm
		*** ERROR: Spurious text after =cut  in file Koha/Filter/MARC/Null.pm


Please address this for backport. Thanks!