]> sipb.mit.edu Git - ikiwiki.git/blobdiff - doc/todo/support_multiple_perl_libraries.mdwn
Several libdirs: proposed patch
[ikiwiki.git] / doc / todo / support_multiple_perl_libraries.mdwn
index 2869b5033902c9953f55351a3c638981f70ab498..6e3fe22a4673b6799e8cc08f299baa4047925166 100644 (file)
@@ -8,4 +8,40 @@ I think the change is a one-liner, but I put this here for discussion before att
 
 [[DavidBremner]]
 
+> I would like this feature too, for the very same reasons.
+>
+> To preserve backward compatibility, I tried to implement it in the following way: if `libdir` is a string, it is (as it is right now), a directory in which plugins can be searched; if `libdir` is an array of strings, it is a list of libdirs. The ideal place to put it in would be in subroutine [checkconfig](http://source.ikiwiki.branchable.com/?p=source.git;a=blob;f=IkiWiki.pm;hb=56f8223f9594ae687099dada0c138d669a6f931f#l569). However, plugins are loaded (and option `libdir` is used) in subroutine [loadplugins](http://source.ikiwiki.branchable.com/?p=source.git;a=blob;f=IkiWiki.pm;hb=56f8223f9594ae687099dada0c138d669a6f931f#l713), which is called [just before `checkconfig`](http://source.ikiwiki.branchable.com/?p=source.git;a=blob;f=ikiwiki.in;hb=729991564ec7e1116fc023c51e73b47af8b6fce7#l143).
+>
+> A solution would be to check `libdir` (and turn it into a list if necessary) somewhere in subroutine [getconfig](http://source.ikiwiki.branchable.com/?p=source.git;a=blob;f=ikiwiki.in;hb=729991564ec7e1116fc023c51e73b47af8b6fce7#l26), but I do not know where to put it not to make it look like a bad hackā€¦
+>
+> Any idea about the best place to preprocess `libdir`? Or any better idea to implement this?
+>
+> [[Louis|spalax]]
+
+>> Modifying `getconfig` is not a valid solution, because IkiWiki.pm is also imported by
+>> [[ikiwiki-transition]], [[ikiwiki-calendar]], the regression tests, etc.
+>>
+>> The way I would personally do it is to have a new non-exported function `getlibdirs`
+>> or something, have it do something like this:
+>>
+>>     if (! ref $config{libdir}) {
+>>             if (length $config{libdir}) {
+>>                     $config{libdir} = [$config{libdir}];
+>>             } else {
+>>                     $config{libdir} = [];
+>>             }
+>>     }
+>>     return @{$config{libdir}};
+>>
+>> and replace all uses of $config{libdir} with it.
+>>
+>> --[[smcv]]
+>>>
+>>> I implemented it (see branch ``paternal/libdirs``). I used [[smcv]]'s idea, but
+>>> avoiding side effects. I edited documentation as well. As usual, as neither
+>>> English nor Perl are my first languages (damn! I would be so much more
+>>> efficient in Python) feel free to improve my [[!taglink patch]].
+>>> [[!template  id=gitbranch branch=spalax/paternal/libdirs browse="https://github.com/paternal/ikiwiki/tree/paternal/libdirs" author="[[Louis|spalax]]"]]
+
+
 [[!taglink wishlist]]