Bug 15743

Summary: Allow plugins to embed Perl modules
Product: Koha Reporter: Julian Maurice <julian.maurice>
Component: Architecture, internals, and plumbingAssignee: Julian Maurice <julian.maurice>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: brendan, f.demians
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 15743: Allow plugins to embed Perl modules
[SIGNED-OFF] Bug 15743: Allow plugins to embed Perl modules
Bug 15743: Allow plugins to embed Perl modules

Description Julian Maurice 2016-02-04 16:52:19 UTC
Actually if a plugin comes with several .pm files, they are all treated as separate plugins, and Koha::Plugins die if one of these modules doesn't contain a 'new' subroutine.

Can't locate object method "new" via package "Koha::Plugin::XXX::YYY::..." (perhaps you forgot to load "Koha::Plugin::XXX::YYY::..."?) at /home/koha/src/Koha/Plugins.pm line 66.

It may be useful to have several .pm files to organize code
Comment 1 Julian Maurice 2016-02-04 16:53:22 UTC Comment hidden (obsolete)
Comment 2 Julian Maurice 2016-02-04 17:00:09 UTC
Test plan:
0. Enable plugins
1. Create the smallest valid Perl module (the 'package' line and the '1;' line are enough) in your plugins directory
2. In Koha, go to /cgi-bin/koha/plugins/plugins-home.pl, you should see the error message
3. Apply patch
4. Refresh /cgi-bin/koha/plugins/plugins-home.pl, you should have no error messages, and no new plugins in the table
Comment 3 Mark Tompsett 2016-02-04 21:39:36 UTC Comment hidden (obsolete)
Comment 4 Kyle M Hall (khall) 2016-02-05 12:48:05 UTC
Created attachment 47696 [details] [review]
Bug 15743: Allow plugins to embed Perl modules

This patch allows plugins to embed Perl modules by ignoring Perl modules
in plugins directory that don't inherit from Koha::Plugins::Base

TEST PLAN
---------
1) Edit koha-conf.xml to have enable_plugins set to 1, and
   the pluginsdir set to a particular path.
2) Create a dummy plugin file. (e.g. {that path}/Koha/Plugin/Kaboom.pm)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Brendan Gallagher 2016-02-24 02:03:14 UTC
Pushed to Master - Should be in the May 2016 Release.  Thanks!
Comment 6 Julian Maurice 2016-02-26 15:26:54 UTC
Patch pushed to 3.22.x, will be in 3.22.4
Comment 7 Frédéric Demians 2016-03-01 16:54:15 UTC
This patch has been pushed to 3.20.x, will be in 3.20.9.