http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8244
--- Comment #1 from Julian Maurice <[email protected]> --- Created attachment 10272 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=10272&action=edit Bug 8244: New script xt/find-undefined-subroutines.pl This script tends to detect if Koha scripts use subroutines that are not correctly exported by modules. This can happen when we have circular dependencies between modules. This script does mainly two things: - It rebuilds the hierarchy of Koha Perl modules and replace all the code within subroutines by tests (using Test::More). For each subroutine called in a subroutine, a test is done on if the called subroutine is defined. If it's defined, then it's called (Tested subroutines are only those available in Koha Perl modules, not external modules subroutines). It does almost the same work with Koha Perl scripts, replacing all the code by tests and calling the subroutines if defined. - Launch prove on all created Perl scripts. This results in a summary where failed tests are subroutines that are not exported, but called without the module name prepended. -- To use it: xt/find-undefined-subroutines.pl --src-path /path/to/koha --dest-path /another/path [-v] If you launch it on current master, you will find that almost all scripts return that GetMember is not defined in C4/Auth.pm. Indeed, line 154, GetMember is called without the module name prepended, and before the require statement. But I tried to make this piece of code crash, without success. It seems that this is "dead code". The script doesn't test subroutines prepended by the module name (we assume that they should work in every case, even when there are circular dependencies) so you could temporarily hide these messages by prepending GetMember with the module name in C4::Auth::get_template_and_user Another interesting error returned by the script: in acqui/basketgroup.pl GetBookSeller is undefined. You can test by going to acqui/basketgroup.pl and remove the '?booksellerid=X' part of the url. I think it's dead code too, because fixing this bug causes another bug a little bit further. Note: in acqui/basketgroup.pl, GetBiblioData and GetItemTypes are returned as not defined too, but there is no problem with them in "real code". This is because C4::Biblio and C4::Koha are imported by using require/import instead of use and this is not handled by the script (could be an enhancement). Important note: This script requires PPI module which is not a Koha dependency, but I don't think it should be because this script is only for debugging purposes and of no usefulness for end-users. -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
