Cause of the issue: https://metacpan.org/release/HAARG/perl-5.40.0/view/pod/perldelta.pod#Calling-the-import-method-of-an-unknown-package-produces-a-warning It's a problem with the fresh Debian 13. (it's time we have actual support, CI for it was disabled due to some other issue) Ubuntu 24.04 has perl 5.38 so it works cleanly. But the next in 2026 will also have this issue. == Test plan == 1. Start a Debian 13 Koha: KOHA_IMAGE=main-trixie ktd up 2. Tons of warnings on start but it ends up starting (see end of this message for the warnings) 3. perl -c mainpage.pl 4. Tons of warnings again 5. restart_all 6. Tons of warnings again 7. Things seem to work though (checkout, checkin, search in staff and OPAC) == Severity== Critical because it looks like Koha is broken. And it will hide actual issues. One case in chat from someone upgrading. And us thinking there is really something broken given their output: https://chat.koha-community.org/koha-community/pl/gd8xbsx4p3gadpnk5h8c9n3bzy follow-up: https://chat.koha-community.org/koha-community/pl/w71jx511ppf59cfqezgy1fpcrc And me who though my KTD failed to fully start. And when investigating, when running a test, it looked at first as if it failed. But no it works. == warnings == Attempt to call undefined import method with arguments ("get_session") via package "C4::Auth" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Search/History.pm line 5. Attempt to call undefined import method with arguments ("output_and_exit") via package "C4::Output" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Auth.pm line 35. Attempt to call undefined import method with arguments ("GetNormalizedISBN" ...) via package "C4::Koha" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Biblio.pm line 27. Attempt to call undefined import method with arguments ("haspermission") via package "C4::Auth" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Serials.pm line 37. Attempt to call undefined import method with arguments ("UpdateStats") via package "C4::Stats" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Circulation.pm line 28. Attempt to call undefined import method with arguments ("CheckReserves" ...) via package "C4::Reserves" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Circulation.pm line 30. Attempt to call undefined import method with arguments ("barcodedecode") via package "C4::Circulation" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Items.pm line 49. Attempt to call undefined import method with arguments ("getitemtypeimagelocation") via package "C4::Koha" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/ItemType.pm line 20. Attempt to call undefined import method with arguments ("GetPreparedLetter" ...) via package "C4::Letters" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Message.pm line 24. Attempt to call undefined import method with arguments ("UpdateStats") via package "C4::Stats" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Account.pm line 28. Attempt to call undefined import method with arguments ("GetFine") via package "C4::Overdues" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Account.pm line 29. Attempt to call undefined import method with arguments ("checkpw_hash") via package "C4::Auth" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Patron.pm line 30. Attempt to call undefined import method with arguments ("GetPreparedLetter" ...) via package "C4::Letters" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Patron.pm line 32. Attempt to call undefined import method with arguments ("AddReturn") via package "C4::Circulation" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Checkouts.pm line 23. Attempt to call undefined import method with arguments ("AddRenewal" ...) via package "C4::Circulation" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Checkout.pm line 26. Attempt to call undefined import method with arguments ("CanBookBeIssued" ...) via package "C4::Circulation" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/CurbsidePickup.pm line 26. Attempt to call undefined import method with arguments ("GetMessagingPreferences") via package "C4::Members::Messaging" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/CurbsidePickup.pm line 27. Attempt to call undefined import method with arguments ("GetPreparedLetter" ...) via package "C4::Letters" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/CurbsidePickup.pm line 28. Attempt to call undefined import method with arguments ("barcodedecode" ...) via package "C4::Circulation" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Item.pm line 29. Attempt to call undefined import method with arguments ("GetBranchItemRule") via package "C4::Circulation" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/HoldsQueue.pm line 26. Attempt to call undefined import method with arguments ("UpdateStats") via package "C4::Stats" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Recalls.pm line 28. Attempt to call undefined import method with arguments ("GetPreparedLetter" ...) via package "C4::Letters" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Hold.pm line 26. Attempt to call undefined import method with arguments ("GetAuthorisedValues") via package "C4::Koha" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/ILL/Request/Logger.pm line 23. Attempt to call undefined import method with arguments ("CanBookBeIssued" ...) via package "C4::Circulation" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/ILL/Request.pm line 49. Attempt to call undefined import method with arguments ("GetPreparedLetter") via package "C4::Letters" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Members.pm line 29.
> And when investigating, when running a test, it looked at first > as if it failed. But no it works. It really depends on the test. There are tons of tests with `use Test::NoWarnings;` that blow up. prove t/Budgets And those who don't, calling prove on multiple test files becomes unreadable.
This is an interesting one. Take this warning: Attempt to call undefined import method with arguments ("get_session") via package "C4::Auth" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Search/History.pm line 5. Line 5 is the following: use C4::Auth qw( get_session ); At a glance, that's not the same as 'Class::That::Does::Not::Exist->import("foo");' If we look at C4/Auth.pm, we'll see that we set up Exporter similar to how the documentation suggests on the Exporter documentation page. That said... it could be worthwhile looking at https://perldoc.perl.org/Exporter#Playing-Safe
Given how these warnings are all coming from C4 modules, it adds weight to the idea that the issue relates to the Exporter. And I'm guessing circular dependencies... although that's just a guess at this stage. -- Looking at other reports of this online and in their cases it seems to relate more to the "use Module VERSION LIST" syntax.
(In reply to Victor Grousset/tuxayo from comment #0) > == Test plan == > 1. Start a Debian 13 Koha: KOHA_IMAGE=main-trixie ktd up So I used the "ku" alias instead of "bin/ktd". I had to set the KOHA_IMAGE in my .env file. Then I kept getting this error at startup: koha-1 | Running [koha-mysql kohadev -e 'UPDATE systempreferences SET value="1" WHERE variable="RESTBasicAuth"']... koha-1 | ERROR 2026 (HY000): TLS/SSL error: SSL is required, but the server does not support it koha-1 exited with code 1 So on my next try while the container was starting up, I got onto the container and did the following to turn off SSL for the client: vi /etc/mysql/my.cnf ssl=off
Once I'm on a fully started up container using KOHA_IMAGE=main-trixie, I do this simple test: perl -MC4::Auth -e "warn 'bowwow';" This yields many warnings: Attempt to call undefined import method with arguments ("get_session") via package "C4::Auth" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Search/History.pm line 5. Attempt to call undefined import method with arguments ("get_template_and_user") via package "C4::Auth" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Output.pm line 33. Attempt to call undefined import method with arguments ("GetNormalizedISBN" ...) via package "C4::Koha" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Biblio.pm line 27. Attempt to call undefined import method with arguments ("haspermission") via package "C4::Auth" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Serials.pm line 37. Attempt to call undefined import method with arguments ("UpdateStats") via package "C4::Stats" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Circulation.pm line 28. Attempt to call undefined import method with arguments ("CheckReserves" ...) via package "C4::Reserves" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Circulation.pm line 30. Attempt to call undefined import method with arguments ("barcodedecode") via package "C4::Circulation" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Items.pm line 49. Attempt to call undefined import method with arguments ("getitemtypeimagelocation") via package "C4::Koha" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/ItemType.pm line 20. Attempt to call undefined import method with arguments ("GetPreparedLetter" ...) via package "C4::Letters" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Message.pm line 24. Attempt to call undefined import method with arguments ("UpdateStats") via package "C4::Stats" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Account.pm line 28. Attempt to call undefined import method with arguments ("GetFine") via package "C4::Overdues" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Account.pm line 29. Attempt to call undefined import method with arguments ("checkpw_hash") via package "C4::Auth" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Patron.pm line 30. Attempt to call undefined import method with arguments ("GetPreparedLetter" ...) via package "C4::Letters" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Patron.pm line 32. Attempt to call undefined import method with arguments ("AddReturn") via package "C4::Circulation" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Checkouts.pm line 23. Attempt to call undefined import method with arguments ("AddRenewal" ...) via package "C4::Circulation" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Checkout.pm line 26. Attempt to call undefined import method with arguments ("CanBookBeIssued" ...) via package "C4::Circulation" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/CurbsidePickup.pm line 26. Attempt to call undefined import method with arguments ("GetMessagingPreferences") via package "C4::Members::Messaging" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/CurbsidePickup.pm line 27. Attempt to call undefined import method with arguments ("GetPreparedLetter" ...) via package "C4::Letters" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/CurbsidePickup.pm line 28. Attempt to call undefined import method with arguments ("barcodedecode" ...) via package "C4::Circulation" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Item.pm line 29. Attempt to call undefined import method with arguments ("GetBranchItemRule") via package "C4::Circulation" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/HoldsQueue.pm line 26. Attempt to call undefined import method with arguments ("UpdateStats") via package "C4::Stats" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Recalls.pm line 28. Attempt to call undefined import method with arguments ("GetPreparedLetter" ...) via package "C4::Letters" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Hold.pm line 26. Attempt to call undefined import method with arguments ("GetAuthorisedValues") via package "C4::Koha" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/ILL/Request/Logger.pm line 23. Attempt to call undefined import method with arguments ("CanBookBeIssued" ...) via package "C4::Circulation" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/ILL/Request.pm line 49. Attempt to call undefined import method with arguments ("GetPreparedLetter") via package "C4::Letters" (Perhaps you forgot to load the package?) at /kohadevbox/koha/C4/Members.pm line 29. bowwow at -e line 1. If we re-factor C4::Auth's internals to move "use C4::Context;" and all the Exporter stuff to above our Koha module loads, then we can eliminate the warnings for C4::Auth in this list. -- This suggests that it is indeed an issue with how we setup the Exporter. If you look carefully at files like C4::Auth, the way we set up the Exporter makes no sense. Let's look at another example... Attempt to call undefined import method with arguments ("GetNormalizedISBN" ...) via package "C4::Koha" (Perhaps you forgot to load the package?) at /kohadevbox/koha/Koha/Biblio.pm line 27. The 27th line of Koha::Biblio is the following: use C4::Koha qw( GetNormalizedISBN GetNormalizedUPC GetNormalizedOCLCNumber ); We move the Exporter block up to under Modern::Perl, and we re-run this code: perl -MC4::Auth -e "warn 'bowwow';" And sure enough the warnings for C4::Koha disappear from the list as well.
So it looks like we have some cleanup to do before supporting Debian Trixie (13) or Ubuuntu plucky (25.04) Here is grep -l -R "Exporter" C4/* | wc -l 66 grep -l -R "Exporter" Koha/* | wc -l 22 It looks like there might be some other problem files too... For some bizarre reason suggestion/suggestion.pl has a "require Exporter" statement in it as well. -- Note that not all cases will need to be fixed either. At a glance, Koha/Util/Normalize.pm looks like its Exporter setup is fine. But all cases will need to be reviewed at the very least, although we could probably make that easier by just doing this: find C4 Koha -name "*.pm" -exec perl -c {} \;
Anyway, hopefully that's illuminating.
I've updated the "System requirements and recommendations" wiki page to say we're not recommending these latest Debian/Ubuntu OSes, and that people should double-check the supported OSes for the supported Koha versions.
Recent struggles with module dependencies, imports, exports were bug 36432 and bug 35959 In case the other considered solutions and the final patches can help.
also bug 36526 ----- IIUC, a way to fix would be to move BEGIN sections (eventually in rare cases splitting them) containing the exports. So moving them above our bunch of `use C4::foo`? Because one of them might transitively `use C4::the_current_module qw( plop );`. And it fails because the exports are after the `use C4::foo`. So it can finish processing `use C4::foo` without doing `use C4::the_current_module qw( plop );`. Which is not ready because the exports are not done yet. Does a fix can look like this?: https://gitlab.com/tuxayo/Koha/-/commit/8859404205a18bcfe06efe9f19a83871243d51a2 Is removes some warnings but I'm not sure if I moved stuff the right way at the best place.