[Koha-bugs] [Bug 23384] New: Calling Koha::Article::Status::* without "use" in Patron.pm can cause breakage

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jul 26 15:31:45 CEST 2019


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23384

            Bug ID: 23384
           Summary: Calling Koha::Article::Status::* without "use" in
                    Patron.pm can cause breakage
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Architecture, internals, and plumbing
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: andrew.isherwood at ptfs-europe.com
        QA Contact: testopia at bugs.koha-community.org

After spending a while digging into this, I can't explain why it's a problem,
but I know that it is and I know how to fix it.

During the development of Bug 23112 I encountered a weird problem whereby
adding "use Illrequests" to C4/Circulation.pm causes the whole of the app to
break with the following error:

Bareword "Koha::ArticleRequest::Status::Pending" not allowed while "strict
subs" in use at /home/koha-koha/kohaclone/Koha/Patron.pm line 811.
Bareword "Koha::ArticleRequest::Status::Processing" not allowed while "strict
subs" in use at /home/koha-koha/kohaclone/Koha/Patron.pm line 811.
Compilation failed in require at /home/koha-koha/kohaclone/Koha/Illrequest.pm
line 37.
BEGIN failed--compilation aborted at
/home/koha-koha/kohaclone/Koha/Illrequest.pm line 37.
Compilation failed in require at /home/koha-koha/kohaclone/Koha/Illrequests.pm
line 23.
BEGIN failed--compilation aborted at
/home/koha-koha/kohaclone/Koha/Illrequests.pm line 23.
Compilation failed in require at /home/koha-koha/kohaclone/C4/Circulation.pm
line 49.
BEGIN failed--compilation aborted at
/home/koha-koha/kohaclone/C4/Circulation.pm line 49.
Compilation failed in require at /home/koha-koha/kohaclone/C4/Overdues.pm line
31.
BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/C4/Overdues.pm
line 31.
Compilation failed in require at /home/koha-koha/kohaclone/C4/Members.pm line
32.
BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/C4/Members.pm
line 32.
Compilation failed in require at /home/koha-koha/kohaclone/C4/Letters.pm line
30.
BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/C4/Letters.pm
line 30.
Compilation failed in require at /home/koha-koha/kohaclone/C4/Suggestions.pm
line 29.
BEGIN failed--compilation aborted at
/home/koha-koha/kohaclone/C4/Suggestions.pm line 29.
Compilation failed in require at /home/koha-koha/kohaclone/C4/Acquisition.pm
line 25.
BEGIN failed--compilation aborted at
/home/koha-koha/kohaclone/C4/Acquisition.pm line 25.
Compilation failed in require at /home/koha-koha/kohaclone/C4/Budgets.pm line
27.
BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/C4/Budgets.pm
line 27.
Compilation failed in require at /home/koha-koha/kohaclone/C4/Biblio.pm line
94.
BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/C4/Biblio.pm
line 94.
Compilation failed in require at /home/koha-koha/kohaclone/Koha/Biblio.pm line
27.
BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/Biblio.pm
line 27.
Compilation failed in require at /home/koha-koha/kohaclone/Koha/Biblios.pm line
26.
BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/Biblios.pm
line 26.
Compilation failed in require at
/home/koha-koha/kohaclone/Koha/ArticleRequest.pm line 26.
BEGIN failed--compilation aborted at
/home/koha-koha/kohaclone/Koha/ArticleRequest.pm line 26.
Compilation failed in require at
/home/koha-koha/kohaclone/Koha/ArticleRequests.pm line 26.
BEGIN failed--compilation aborted at
/home/koha-koha/kohaclone/Koha/ArticleRequests.pm line 26.
Compilation failed in require at /home/koha-koha/kohaclone/Koha/Patrons.pm line
28.
BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/Patrons.pm
line 28.
Compilation failed in require at /home/koha-koha/kohaclone/Koha/Item.pm line
33.
BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/Item.pm
line 33.
Compilation failed in require at /home/koha-koha/kohaclone/Koha/Items.pm line
26.
BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/Items.pm
line 26.
Compilation failed in require at /home/koha-koha/kohaclone/Koha/Checkout.pm
line 28.
BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/Koha/Checkout.pm
line 28.
Compilation failed in require at /home/koha-koha/kohaclone/Koha/Checkouts.pm
line 25.
BEGIN failed--compilation aborted at
/home/koha-koha/kohaclone/Koha/Checkouts.pm line 25.
Compilation failed in require at /home/koha-koha/kohaclone/C4/Auth.pm line 37.
BEGIN failed--compilation aborted at /home/koha-koha/kohaclone/C4/Auth.pm line
37.
Compilation failed in require at /home/koha-koha/kohaclone/admin/preferences.pl
line 23.
BEGIN failed--compilation aborted at
/home/koha-koha/kohaclone/admin/preferences.pl line 23.

The reference to "preferences.pl" is a red herring and just reflects the page
you're on at the time. The rest of the error is the same regardless of the
page.

Poking around, I've not been able to determine why the usage of Illrequest in
Circulation.pm would cause Patron.pm to suddenly complain about
Koha::ArticleRequest::Status::* calls being barewords. With Modern::Perl the
strict subs pragma should catch that sort of stuff. So I've really got no idea
what's going on.

Anyway, the obvious fix is to add "use Koha::ArticleRequest::Status;" to
Patron.pm, which is what the patch for this bug is going to do. I just wish I
understood why it's a problem in the first place!

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list