CompUnit::DynamicLoader - load modules from temporarily included locations
NAME
CompUnit::DynamicLoader - load modules from temporarily included locations
SYNOPSIS
use CompUnit::DynamicLib;
my @includes = <plugin/lib module/lib other/lib>;
require-from(@includes, "MyPlugin::Module");
use-lib-do @includes, { require ModuleX; require ModuleY <&something>; }
EXPORTED ROUTINES
sub use-lib-do
multi sub use-lib-do(@include, &block)
multi sub use-lib-do($include, &block)
Given a set of repository specs to @include
(or $include
) and a &block
to run, add those repositories (usually directory names) to $*REPO
, run the &block
, and then strip the temporary repositories back out again.
sub require-from
multi sub require-from(@include, $module-name)
multi sub require-from($include, $module-name)
In cases where you only need to load a single module, this can be used as a shortcut for:
use-lib-do @include, { require ::($module-name) };
CAVEATS
This is not implemented correctly as of v0.2. The original implementation in v0.1 tripped on a Raku bug reported in https://rt.perl.org/Ticket/Display.html?id=129109. The chosen work-around is not ideal.
AUTHOR & COPYRIGHT
Copyright 2016 Sterling Hanenkamp.
This software is made available under the same terms as Raku itself.