diff options
author | Karen Etheridge <ether@cpan.org> | 2012-03-02 21:57:54 +0000 |
---|---|---|
committer | Karen Etheridge <ether@cpan.org> | 2013-06-21 21:25:08 -0700 |
commit | da64122a3fb0c5c747fb88dfce9909285697cfc2 (patch) | |
tree | aa7230be847eb789eef134c2889ed4fd93bcef00 /lib/Dist | |
parent | 8383bd1012327feb3823ac62222155d4f73cc6ce (diff) | |
download | dist-checkconflicts-da64122a3fb0c5c747fb88dfce9909285697cfc2.tar.gz dist-checkconflicts-da64122a3fb0c5c747fb88dfce9909285697cfc2.zip |
fix for RT#75486: instead of silently ignoring conflicts that do not compile, issue a conflict warning
Diffstat (limited to 'lib/Dist')
-rw-r--r-- | lib/Dist/CheckConflicts.pm | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/Dist/CheckConflicts.pm b/lib/Dist/CheckConflicts.pm index 1fea9e2..393e586 100644 --- a/lib/Dist/CheckConflicts.pm +++ b/lib/Dist/CheckConflicts.pm @@ -11,6 +11,8 @@ our @EXPORT = our @EXPORT_OK = ( use Carp; use List::MoreUtils 0.12 'first_index'; +use Class::Load 'try_load_class'; +use Module::Runtime 'module_notional_filename'; =head1 SYNOPSIS @@ -131,7 +133,7 @@ sub import { for my $conflict (keys %conflicts) { (my $file = $conflict) =~ s{::}{/}g; $file .= '.pm'; - if (exists $INC{$file}) { + if (exists $INC{module_notional_filename($conflict)}) { _check_version([$for], $conflict); } } @@ -266,18 +268,20 @@ sub calculate_conflicts { my @ret; + CONFLICT: for my $conflict (keys %conflicts) { - { - local $SIG{__WARN__} = sub { }; - eval "require $conflict; 1" or next CONFLICT; - } - my $installed = $conflict->VERSION; + my ($success, $error) = try_load_class($conflict); + my $file = module_notional_filename($conflict); + next if not $success and $error =~ /Can't locate \Q$file\E in \@INC/; + + warn "Warning: $conflict did not compile" if not $success; + my $installed = $success ? $conflict->VERSION : 'unknown'; push @ret, { package => $conflict, installed => $installed, required => $conflicts{$conflict}, - } if $installed le $conflicts{$conflict}; + } if not $success or $installed le $conflicts{$conflict}; } return sort { $a->{package} cmp $b->{package} } @ret; |