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
Created attachment 47651 [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: 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
Created attachment 47657 [details] [review] [SIGNED-OFF] 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) --- BEGIN Kaboom.pm --- package Koha::Plugin::Kaboom; use Modern::Perl; our $VERSION = '1'; 1; --- END Kaboom.pm --- 3) Sign in to staff client 4) Reports -> Report plugins -- commented line version explodes. 5) Apply patch 6) Reports -> Report plugins -- commented line version works. -- the ?method= portion in the address bar prevents you from seeing that the plugin is actually considered, because various methods are not defined. Delete that portion of the URL, and you should see a thin empty second row appear. 7) run koha qa tests Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
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>
Pushed to Master - Should be in the May 2016 Release. Thanks!
Patch pushed to 3.22.x, will be in 3.22.4
This patch has been pushed to 3.20.x, will be in 3.20.9.