diff --git a/FEATURE_MATRIX.md b/FEATURE_MATRIX.md index de8b749..02af00a 100644 --- a/FEATURE_MATRIX.md +++ b/FEATURE_MATRIX.md @@ -289,14 +289,14 @@ Here’s an alternative approach using the Exporter module: Here’s an alternative approach using the Symbol module: ```perl - use Symbol 'qualify_to_ref'; + use Symbol; sub import { my $pkg = shift; my $callpkg = caller(0); # Dynamically assign the Dumper function to the caller's namespace - my $sym_ref = qualify_to_ref('Dumper', $callpkg); + my $sym_ref = Symbol::qualify_to_ref('Dumper', $callpkg); *$sym_ref = \&Dumper; return; diff --git a/src/main/java/org/perlonjava/runtime/RuntimeScalar.java b/src/main/java/org/perlonjava/runtime/RuntimeScalar.java index dd857b0..a15a8b1 100644 --- a/src/main/java/org/perlonjava/runtime/RuntimeScalar.java +++ b/src/main/java/org/perlonjava/runtime/RuntimeScalar.java @@ -901,7 +901,7 @@ public RuntimeScalar createReference() { // Return a reference to the subroutine with this name: \&$a public RuntimeScalar createCodeReference(String packageName) { String name = NameNormalizer.normalizeVariableName(this.toString(), packageName); - System.out.println("Creating code reference: " + name + " got: " + GlobalContext.getGlobalCodeRef(name)); + // System.out.println("Creating code reference: " + name + " got: " + GlobalContext.getGlobalCodeRef(name)); return GlobalContext.getGlobalCodeRef(name); } diff --git a/src/main/perl/lib/Test/More.pm b/src/main/perl/lib/Test/More.pm index 578221f..40933b4 100644 --- a/src/main/perl/lib/Test/More.pm +++ b/src/main/perl/lib/Test/More.pm @@ -2,7 +2,7 @@ package Test::More; use strict; use warnings; -use Exporter 'import'; +# use Exporter 'import'; use Symbol 'qualify_to_ref'; our @EXPORT = qw( @@ -14,15 +14,18 @@ my $Test_Count = 0; my $Plan_Count; my $Failed_Count = 0; -# sub import { -# my $package = shift; -# my $caller = caller; -# -# for my $symbol (@EXPORT) { -# my $full_name = qualify_to_ref($symbol, $caller); -# *$full_name = \&{$symbol}; -# } -# } +sub import { + my $package = shift; + my $caller = caller; + if (@_) { + plan(@_); + } + + for my $symbol (@EXPORT) { + my $full_name = Symbol::qualify_to_ref($symbol, $caller); + *$full_name = \&{$symbol}; + } +} sub plan { my ($directive, $arg) = @_; diff --git a/src/test/resources/regex_named_capture.pl b/src/test/resources/regex_named_capture.pl index 62b43c5..9aa2324 100644 --- a/src/test/resources/regex_named_capture.pl +++ b/src/test/resources/regex_named_capture.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl use strict; use warnings; -use Test::More; +use Test::More tests => 4; # Test case 1: Simple named capture my $string1 = 'foo';