In Modules§
See primary documentation in context for need
need
loads a compunit
at compile time.
need MyModule;
Any packages in the namespace defined within will also be available.
# MyModule.rakumodunit ;
MyModule::Class
will be defined when MyModule
is loaded, and you can use it directly employing its fully qualified name (FQN). Classes and other types defined that way are not automatically exported; you will need to explicitly export it if you want to use it by its short name:
# MyModule.rakumodunit ;is export
And then
use MyModule;my = Class.new();say .raku;