How can find modules that have been installed locally, and which I can use
in a Raku program?
Assume that we have three distributions: Parent, Brother, Sister. Parent 'provides' Top.rakumod
, while Brother and Sister provide 'Top::Son.rakumod' and 'Top::Daughter.rakumod', respectively. Brother and Sister have a 'depends': 'Top' in their META6.json.
Each distribution is in its own git repo. And each are installed by zef.
Suppose Top is set up as a class with an interface method, perhaps something like: multi method on-starting { ... }
, which each sub-class has to implement, and which when run, provides the caller with information about the sub-class. So both Top::Brother
and Top::Daughter
implement on-starting
. There could also be distributions Top::Aunt
and so on, which are not locally installed. We need to find which are installed.
So, now we run an instance of Top (as defined in Parent). It needs to look for installed modules that match Top::*
. The place to start (I think) is $*REPO
, which is a linked list of repositories containing the modules that are installed. $*REPO also does the CompUnit::Repository role, which in turn has a 'need' method.
What I don't understand is how to manipulate $*REPO to get a list of all the candidate modules that match Top::*
, along the whole of the linked list.
Once I have the list of candidates, I can use ^can
to check it has a on-starting
method, and then call that method.
If this is not the way to get to a result where Top finds out about locally installed modules, I'd appreciate some alternatives to the scheme I just laid out.
zef list --installed
help--maybe called as aproc
from within Raku? – Fetch