Test case:
use 5.026;
use Perl6::Controls qw(for);
for (1..10) -> $n {
say $n;
}
loop {};
Expect:
Can't call method "loop" without a package or object reference
Got:
infinite loop
use Perl6::Controls qw(for);
BEGIN {
delete $^H{'Keyword::Simple/keywords'}{"loop"};
}
...
which I stumbled into running your script through B::Deparse
.
To pick and choose the keywords you want to keep, you could say
use Perl6::Controls;
BEGIN {
my @keep = ...; # e.g. @keep = qw(for);
my %keywords;
@keywords{@keep} = @{$^H{'Keyword::Simple/keywords'}}{@keep};
$^H{'Keyword::Simple/keywords'} = \%keywords;
}
You can't. Looking at the source-code for Perl6::Controls it uses it's own import method to define all the new keywords using Keyword::Declare. It ignores any parameters passed on the use line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With