Skip to content

Instantly share code, notes, and snippets.

@lizmat
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lizmat/a10b3e6b659cfe7dd762 to your computer and use it in GitHub Desktop.
Save lizmat/a10b3e6b659cfe7dd762 to your computer and use it in GitHub Desktop.
Diff for lazy @*INC initialization
diff --git a/src/core/Inc.pm b/src/core/Inc.pm
index 3d6f07f..5b246f4 100644
--- a/src/core/Inc.pm
+++ b/src/core/Inc.pm
@@ -1,4 +1,4 @@
-{
+sub INIT-INC-CUSTOM_LIB($inc) {
my @INC;
my %CUSTOM_LIB;
@@ -177,6 +177,16 @@
PROCESS::<%CUSTOM_LIB> := %CUSTOM_LIB;
nqp::bindhllsym('perl6', 'ModuleLoader', CompUnitRepo);
+
+ $inc ?? @INC !! %CUSTOM_LIB;
+}
+
+multi sub INITIALIZE_DYNAMIC('@*INC') {
+ INIT-INC-CUSTOM_LIB(1);
+
+}
+multi sub INITIALIZE_DYNAMIC('%*CUSTOM_LIB') {
+ INIT-INC-CUSTOM_LIB(0);
}
# vim: ft=perl6 expandtab sw=4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment