How to install local modules?

I use to create and maintain Perl 5 modules Dist::Zilla. One of my favorite features is installing local modules.

However, with Perl 6, I'm not sure how to install local modules. Of course I can use use lib:

use lib 'relative/path';
use My::Awesome::Module;

But I really would like to install My::Awesome::Module, so all I had to do was useit:

use My::Awesome::Module;

One way to achieve this is to install PERL6LIB, but it is still not “installing" a type module zef install ./My-Awesome-Module.


Update: it looks like I need to create the corresponding META6.json file .

+8
source share
2 answers

, , , . . , META6.json, , - , , /. META6.json :

zef install ./My-Awesome-Module

( ) :

my $install-to-repo = CompUnit::RepositoryRegistry.repository-for-name("site");
my $preinstall-dist = Distribution::Path.new("./My-Awesome-Module");
$install-to-repo.install($preinstall-dist);

rakudo 2019.01, , , META6.json - , , , , , ,

my $read-from-repo   = CompUnit::Repository::FileSystem.new(prefix => "./My-Awesome-Module/lib");
my $install-to-repo  = CompUnit::RepositoryRegistry.repository-for-name("site");
my $some-module-name = "My::Awesome::Module"; # needed to get at the Distribution object in the next step
my $preinstall-dist  = $read-from-repo.candidates($some-module-name).head;
$install-to-repo.install($preinstall-dist);
0

Source: https://habr.com/ru/post/1016329/


All Articles