Konrad Eisele
Konrad Eisele

Reputation: 3194

How do I load a module relative to script in Raku with Raku equivalent of FindBin

Suppose I have 2 files in a directory

p.pl  
Mod.pm

In perl5 I can load a module Mod.pm from p.pl via:

use FindBin qw($Bin);
use lib "$Bin";
...
use Mod;

I wonder what the Raku equivalent would be (if files are p.raku and Mod.rakumod)?

What I want to accomplish is to load a module relative to a script.

Upvotes: 6

Views: 289

Answers (1)

Konrad Eisele
Konrad Eisele

Reputation: 3194

As ValleLukas explained:

use lib $*PROGRAM.dirname
use Mod;

can be used.

Upvotes: 7

Related Questions