New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFE: enhancement of corelist script #16444
Comments
From perl-diddler@tlinx.orgCreated by perl-diddler@tlinx.orgI would like to propose an enhancement for the 'corelist' Proposal is to add switch(es) '-t|--test' that would This gives an easy way to test if a module is present in I threw together a sample patch against 5.26.0 ===================== Inline Patch--- corelist.orig 2017-09-26 10:05:01.000000000 -0700
+++ corelist 2018-02-28 13:38:09.750160500 -0800
@@ -14,6 +14,7 @@
=head1 SYNOPSIS
corelist -v
+ corelist -t [ <ModuleName ]
corelist [-a|-d] <ModuleName> | /<ModuleRegex>/ [<ModuleVersion>] ...
corelist [-v <PerlVersion>] [ <ModuleName> | /<ModuleRegex>/ ] ...
corelist [-r <PerlVersion>] ...
@@ -145,7 +146,8 @@
GetOptions(
\%Opts,
- qw[ help|?! man! r|release:s v|version:s a! d diff|D feature|f u|upstream ]
+ qw[ help|?! man! r|release:s v|version:s a! d diff|D feature|f u|upstream
+ t|test a!]
);
pod2usage(1) if $Opts{help};
@@ -175,6 +177,8 @@
exit 0;
}
+$Opts{v}=$] if exists($Opts{t}) ? 1 : 0;
+
if(exists $Opts{v} ){
if( !$Opts{v} ) {
print "\nModule::CoreList has info on the following perl versions:\n";
@@ -278,6 +282,8 @@
pod2usage(0);
}
+my $exit_status=0;
+
while (@ARGV) {
my ($mod, $ver);
if ($ARGV[0] =~ /=/) {
@@ -288,7 +294,7 @@
}
if ($mod !~ m|^/(.*)/([imosx]*)$|) { # not a regex
- module_version($mod,$ver);
+ ++$exit_status if module_version($mod,$ver);
} else {
my $re;
eval { $re = $2 ? qr/(?$2)($1)/ : qr/$1/; }; # trap exceptions while building regex
@@ -310,7 +316,7 @@
}
}
-exit();
+exit($exit_status);
sub module_version {
my($mod,$ver) = @_;
@@ -319,8 +325,9 @@
my $numeric_v = numify_version($Opts{v});
my $version_hash = Module::CoreList->find_version($numeric_v);
if ($version_hash) {
+ return $version_hash->{$mod} ? 0 : 1 if $Opts{t};
print $mod, " ", $version_hash->{$mod} || 'undef', "\n";
- return;
+ return 0;
}
else { die "Shouldn't happen" }
}
The above is the simple case of checking for the module Thanks, Perl Info
|
From @jkeenanOn Wed, 28 Feb 2018 22:27:41 GMT, LAWalsh wrote:
I think the maintainer of Module::CoreList should have first crack at evaluating this request. However, I would recommend the following: * Pull the patch against the version of Module::CoreList in Perl 5 blead, i.e., in a checkout from our git repository. * Add tests for this feature in dist/Module-CoreList/t/. * Attach the patch to this RT (or to your email response), i.e., don't inline the patch. These steps will make the patch easier to evaluate. Thank you very much. -- |
The RT System itself - Status changed from 'new' to 'open' |
From @GrinnzOn Tue, Sep 4, 2018 at 11:56 AM James E Keenan via RT <
I'll also note that, separate from whether the maintainer decides to add perl -MModule::CoreList -E'say Module::CoreList::is_core(shift) ? 1 : 0' perl -MModule::CoreList -E'say Module::CoreList::is_core(shift, undef, -Dan |
From perl-diddler@tlinx.orgOn 9/4/2018 9:04 AM, Dan Book via RT wrote:
Easy is in the eye of the beholder. *ahem*. I wouldn't exactly call that |
Migrated from rt.perl.org#132923 (status was 'open')
Searchable as RT132923$
The text was updated successfully, but these errors were encountered: