Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my sub load-modules($base, $namespace, $name-matcher) {
- say "load-modules";
- list-modules($base, $namespace, $name-matcher)
- .map({ require-module( $_ ) })
- .grep({ !.isa(Nil) }) # Filter out modules that failed to load
- .unique # Potentially, there could be the same module installed and in lib at the same time
- .Array;
- }
- my sub require-module($module-name) {
- try {
- require ::($module-name);
- return ::($module-name);
- }
- given $! {
- .say if ($*DEBUG-PLUGINS//False);
- say .WHAT.perl, do given .backtrace[0] { .file, .line, .subname }
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement