summaryrefslogtreecommitdiffstats
path: root/maintainers/scripts
diff options
context:
space:
mode:
authorydlr <ydlr@ydlr.io>2020-03-14 00:25:33 -0500
committerydlr <ydlr@ydlr.io>2020-03-14 00:25:33 -0500
commit9035381b11412bb5af34f92082ce7611118710f3 (patch)
treef2031cfedd5c08cd1b1c315c8388b7d2fcaf1da8 /maintainers/scripts
parent5e2beafd022f886107ac3be5911c5bda4dc9676f (diff)
nix-generate-from-cpan: use Module::CoreList to detect core modules
The previous way of detecting core modules failed to filter "if" and possibly other core modules.
Diffstat (limited to 'maintainers/scripts')
-rwxr-xr-xmaintainers/scripts/nix-generate-from-cpan.pl11
1 files changed, 3 insertions, 8 deletions
diff --git a/maintainers/scripts/nix-generate-from-cpan.pl b/maintainers/scripts/nix-generate-from-cpan.pl
index d258f4df8d8e..f02af4ea6693 100755
--- a/maintainers/scripts/nix-generate-from-cpan.pl
+++ b/maintainers/scripts/nix-generate-from-cpan.pl
@@ -6,6 +6,7 @@ use warnings;
use CPAN::Meta();
use CPANPLUS::Backend();
+use Module::CoreList;
use Getopt::Long::Descriptive qw( describe_options );
use JSON::PP qw( encode_json );
use Log::Log4perl qw(:easy);
@@ -278,14 +279,8 @@ sub get_deps {
foreach my $n ( $deps->required_modules ) {
next if $n eq "perl";
- # Figure out whether the module is a core module by attempting
- # to `use` the module in a pure Perl interpreter and checking
- # whether it succeeded. Note, $^X is a magic variable holding
- # the path to the running Perl interpreter.
- if ( system("env -i $^X -M$n -e1 >/dev/null 2>&1") == 0 ) {
- DEBUG("skipping Perl-builtin module $n");
- next;
- }
+ my @core = Module::CoreList->find_modules(qr/^$n$/);
+ next if (@core);
my $pkg = module_to_pkg( $cb, $n );