- eval "use $module $version ()";
- if ($@) {
- my $error = $@;
- $error =~ s/\n(.*)$//s;
- undef $error unless $error =~ /this is only/;
- found("$module $version", 0, $error);
+ if ( $args{'list-deps'} ) {
+ print $module, ': ', $version || 0, "\n";
+ }
+ else {
+ eval "use $module $version ()";
+ if ( my $error = $@ ) {
+ return 0 unless wantarray;
+
+ $error =~ s/\n(.*)$//s;
+ $error =~ s/at \(eval \d+\) line \d+\.$//;
+ undef $error if $error =~ /this is only/;
+
+ return ( 0, $error );
+ }
+
+ if ( $avoid ) {
+ my $version = $module->VERSION;
+ if ( grep $version eq $_, @$avoid ) {
+ return 0 unless wantarray;
+ return (0, "It's known that there are problems with RT and version '$version' of '$module' module. If it's the latest available version of the module then you have to downgrade manually.");
+ }
+ }