git.iko.soy/typeable/nixpkgs
on master help sign in
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.

commit9035381b11412bb5af34f92082ce7611118710f3 authorydlr <ydlr@ydlr.io> dateSat 14 Mar 2020, 00:25 (7 years ago) parent5e2beaf
1 file changed+3−8
maintainers/scripts/nix-generate-from-cpan.pl+3−8
maintainers/scripts/nix-generate-from-cpan.pl+3−8
@@ -6,6 +6,7 @@ use warnings;
66
77use CPAN::Meta();
88use CPANPLUS::Backend();
9+use Module::CoreList;
910use Getopt::Long::Descriptive qw( describe_options );
1011use JSON::PP qw( encode_json );
1112use Log::Log4perl qw(:easy);
@@ -278,14 +279,8 @@ sub get_deps {
278279 foreach my $n ( $deps->required_modules ) {
279280 next if $n eq "perl";
280281
281− # Figure out whether the module is a core module by attempting
282− # to `use` the module in a pure Perl interpreter and checking
283− # whether it succeeded. Note, $^X is a magic variable holding
284− # the path to the running Perl interpreter.
285− if ( system("env -i $^X -M$n -e1 >/dev/null 2>&1") == 0 ) {
286− DEBUG("skipping Perl-builtin module $n");
287− next;
288− }
282+ my @core = Module::CoreList->find_modules(qr/^$n$/);
283+ next if (@core);
289284
290285 my $pkg = module_to_pkg( $cb, $n );
291286