diff --git a/src/main/java/org/perlonjava/app/scriptengine/PerlLanguageProvider.java b/src/main/java/org/perlonjava/app/scriptengine/PerlLanguageProvider.java index 82fde36f4..d198f8bec 100644 --- a/src/main/java/org/perlonjava/app/scriptengine/PerlLanguageProvider.java +++ b/src/main/java/org/perlonjava/app/scriptengine/PerlLanguageProvider.java @@ -129,8 +129,8 @@ public static RuntimeList executePerlCode(CompilerOptions compilerOptions, ); if (!globalInitialized) { - GlobalContext.initializeGlobals(compilerOptions); globalInitialized = true; + GlobalContext.initializeGlobals(compilerOptions); } if (CompilerOptions.DEBUG_ENABLED) ctx.logDebug("parse code: " + compilerOptions.code); @@ -306,8 +306,8 @@ public static RuntimeList executePerlAST(Node ast, ); if (!globalInitialized) { - GlobalContext.initializeGlobals(compilerOptions); globalInitialized = true; + GlobalContext.initializeGlobals(compilerOptions); } if (CompilerOptions.DEBUG_ENABLED) ctx.logDebug("Using provided AST"); @@ -600,8 +600,8 @@ public static Object compilePerlCode(CompilerOptions compilerOptions) throws Exc ); if (!globalInitialized) { - GlobalContext.initializeGlobals(compilerOptions); globalInitialized = true; + GlobalContext.initializeGlobals(compilerOptions); } // Tokenize diff --git a/src/main/java/org/perlonjava/core/Configuration.java b/src/main/java/org/perlonjava/core/Configuration.java index e910d1012..408428e8e 100644 --- a/src/main/java/org/perlonjava/core/Configuration.java +++ b/src/main/java/org/perlonjava/core/Configuration.java @@ -33,7 +33,7 @@ public final class Configuration { * Automatically populated by Gradle/Maven during build. * DO NOT EDIT MANUALLY - this value is replaced at build time. */ - public static final String gitCommitId = "c92620f4d"; + public static final String gitCommitId = "4b2bcf8dd"; /** * Git commit date of the build (ISO format: YYYY-MM-DD). @@ -48,7 +48,7 @@ public final class Configuration { * Parsed by App::perlbrew and other tools via: perl -V | grep "Compiled at" * DO NOT EDIT MANUALLY - this value is replaced at build time. */ - public static final String buildTimestamp = "Apr 20 2026 15:59:13"; + public static final String buildTimestamp = "Apr 20 2026 16:15:32"; // Prevent instantiation private Configuration() { diff --git a/src/main/java/org/perlonjava/runtime/runtimetypes/GlobalContext.java b/src/main/java/org/perlonjava/runtime/runtimetypes/GlobalContext.java index f25e674a2..5217bb584 100644 --- a/src/main/java/org/perlonjava/runtime/runtimetypes/GlobalContext.java +++ b/src/main/java/org/perlonjava/runtime/runtimetypes/GlobalContext.java @@ -219,6 +219,14 @@ public static void initializeGlobals(CompilerOptions compilerOptions) { } inc.add(new RuntimeScalar(JAR_PERLLIB)); // internal src/main/perl/lib (lowest priority) + // Honor PERL_USE_UNSAFE_INC=1 (required by CPAN.pm / Module::Install-based + // Makefile.PL scripts that expect `.` in @INC). Perl 5.26 removed `.` from + // @INC by default, but CPAN tooling sets PERL_USE_UNSAFE_INC=1 to restore it. + String unsafeInc = env.getOrDefault("PERL_USE_UNSAFE_INC", new RuntimeScalar("")).toString(); + if (!unsafeInc.isEmpty() && !unsafeInc.equals("0")) { + inc.add(new RuntimeScalar(".")); + } + // Initialize %INC GlobalVariable.getGlobalHash("main::INC");