@@ -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