From 27da03e9363fe156609e7bbea7243cb3be44af38 Mon Sep 17 00:00:00 2001 From: sparrow2009 Date: Wed, 29 Jan 2025 09:54:45 +0100 Subject: [PATCH 1/4] cmd installed: change version range operator to == for corelist'ed modules This only shows up as an issue if directories are passed on the command line like in "cpan-audit installed local/". In that case @INC is not inspected. --- lib/CPAN/Audit.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/CPAN/Audit.pm b/lib/CPAN/Audit.pm index 5e801b9..ccbaa3a 100644 --- a/lib/CPAN/Audit.pm +++ b/lib/CPAN/Audit.pm @@ -196,9 +196,11 @@ sub command_installed { || $self->{db}->{module2dist}->{ $dep->{module} }; next unless $dist; - $dists->{ $dep->{dist} } = '==' . $dep->{version}; + $dists->{ $dep->{dist} } = $dep->{version}; } + $_ = "==$_" for values %$dists; + return; } From 623cb47c3b2c7919b7b58ef92d3c68e29f79e9b3 Mon Sep 17 00:00:00 2001 From: sparrow2009 Date: Wed, 29 Jan 2025 09:54:45 +0100 Subject: [PATCH 2/4] fix option --perl for command installed On evaluation of $Module::CoreList::version{$]} some core modules are mapped to distribution "perl" by module2dist(). Thus distribution "perl" is unconditionally included into the list of inspected distributions even in the absence of option --perl. --- lib/CPAN/Audit.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/CPAN/Audit.pm b/lib/CPAN/Audit.pm index ccbaa3a..84d841e 100644 --- a/lib/CPAN/Audit.pm +++ b/lib/CPAN/Audit.pm @@ -244,6 +244,7 @@ sub command { my $dist = $self->{db}{module2dist}{$mod} or next; $dists->{$dist} = $ver if( ! defined $dists->{$dist} or version->parse($ver) > $dists->{$dist} ); } + delete $dists->{perl}; } } From 1759ccdf24ec7ac06b2188ac8868cc40fd18bd8f Mon Sep 17 00:00:00 2001 From: sparrow2009 Date: Wed, 29 Jan 2025 09:54:45 +0100 Subject: [PATCH 3/4] support option --perl for command deps Fixing option --perl for command installed in the previous commit also entailed the removal of distribution "perl" as a target for inspection for command deps. By adding support for option --perl also to the deps command the old behaviour can be restored on request. --- lib/CPAN/Audit.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/CPAN/Audit.pm b/lib/CPAN/Audit.pm index 84d841e..2e72c41 100644 --- a/lib/CPAN/Audit.pm +++ b/lib/CPAN/Audit.pm @@ -159,6 +159,7 @@ sub command_deps { return "Usage: deps " unless -d $dir; my @deps = $self->{discover}->discover($dir); + push @deps, { dist => 'perl', version => $] } if $self->{include_perl}; $self->verbose( sprintf 'Discovered %d dependencies', scalar(@deps) ); From 8b0eb4a5379f4800ca6170f474b0da7a8bfa079f Mon Sep 17 00:00:00 2001 From: sparrow2009 Date: Wed, 29 Jan 2025 09:54:45 +0100 Subject: [PATCH 4/4] remove incorrect change log entry Remove change log entry "The default range operator is now `==` instead of `>=`." for version 20241208.001. The default range operator was not changed in that release. --- Changes | 3 --- 1 file changed, 3 deletions(-) diff --git a/Changes b/Changes index 7159aae..3aa56b5 100644 --- a/Changes +++ b/Changes @@ -18,9 +18,6 @@ Revision history for Perl extension CPAN-Audit eventually be phased out. * The `installed` command now looks only at the versions you have installed. This changes the comparison from '>=' to '=='. (#62) - * The default range operator is now `==` instead of `>=`. You can - always specify which way you want the check to work by using an - explicit range operator * Since these are significant changes, please report any weird situations that might arise.