mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
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.
This commit is contained in:
parent
5e2beafd02
commit
9035381b11
@ -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 );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user