[Koha-devel] Location of plugins in @INC

Julian Maurice julian.maurice at biblibre.com
Wed Nov 11 11:46:09 CET 2020


Le 11/11/2020 à 01:17, dcook at prosentient.com.au a écrit :
> Hi all,
> 
> I was talking about how we could override default Koha modules with 
> customized versions by just making sure those modules were located 
> earlier in @INC.
> 
> That got me thinking… at the moment we put Koha Plugins at the bottom of 
> @INC, but we could actually put them at the start of @INC.
> 
> They would be more dangerous as they’d be able to override any Perl 
> module… but they would also be more powerful.

More powerful, and quite impossible to maintain, as every change to the 
module would have to be done in the plugin as well :/
Also, two plugins overriding the same module... It just won't work.

> 
> In the context of a Koha where controllers are Perl modules (e.g. 
> Mojolicious controllers) rather than Perl scripts, a plugin could 
> override any controller in Koha. That could make for very powerful and 
> seamless customizations.

For this particular use case I think there are better options, like 
giving plugins access to the Mojolicious router, which allows to 
override some routes.
Also note that Mojolicious has its own plugin system that can be used as 
well. For now the list of plugins used by Mojolicious applications is 
static, but it certainly can be made dynamic without much effort.

-- 
Julian Maurice
BibLibre


More information about the Koha-devel mailing list