Bug 15743 - Allow plugins to embed Perl modules
Summary: Allow plugins to embed Perl modules
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Julian Maurice
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-04 16:52 UTC by Julian Maurice
Modified: 2017-06-14 22:10 UTC (History)
2 users (show)

See Also:
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 (904 bytes, patch)
2016-02-04 16:53 UTC, Julian Maurice
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 15743: Allow plugins to embed Perl modules (1.71 KB, patch)
2016-02-04 21:39 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 15743: Allow plugins to embed Perl modules (1.13 KB, patch)
2016-02-05 12:48 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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.