From e09c0400d6dbd40a963c6b00a6dc73aeac04bf2c Mon Sep 17 00:00:00 2001 From: brian d foy Date: Tue, 6 Aug 2024 14:20:01 -0400 Subject: [PATCH] treat {affected,fixed}_versions as arrays --- script/cpan-audit | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/script/cpan-audit b/script/cpan-audit index e8c73b1..a69b35d 100755 --- a/script/cpan-audit +++ b/script/cpan-audit @@ -36,11 +36,17 @@ sub format_advisory { $s .= " $advisory->{description}\n"; if ( $advisory->{affected_versions} ) { - $s .= " Affected range: $advisory->{affected_versions}\n"; + my @v = ref $advisory->{affected_versions} ? $advisory->{affected_versions}->@* : $advisory->{affected_versions}; + my $first = shift @v; + $s .= " Affected range: $first\n"; + $s .= " $_\n" for @v; } if ( $advisory->{fixed_versions} ) { - $s .= " Fixed range: $advisory->{fixed_versions}\n"; + my @v = ref $advisory->{fixed_versions} ? $advisory->{fixed_versions}->@* : $advisory->{fixed_versions}; + my $first = shift @v; + $s .= " Fixed range: $first\n"; + $s .= " $_\n" for @v; } if ( $advisory->{cves} ) { @@ -114,7 +120,7 @@ sub format_text { sub output_version { my( $class, $exit_code ) = @_; - print "$0 version $VERSION using:\n\tCPAN::Audit @{[ CPAN::Audit->VERSION ]}\n\tCPAN::Audit::DB @{[ CPAN::Audit::DB->VERSION ]}\n"; + print "$0 version $VERSION using:\n\tCPAN::Audit @{[ CPAN::Audit->VERSION ]}\n\tCPANSA::DB @{[ CPANSA::DB->VERSION ]}\n"; exit($exit_code); }