my $module = $_[0];
my $version = $_[1] || '' ;
- return eval "use $module $version; 1";
+ my $got = eval "use $module $version; 1";
+
+ if ($got) {
+ return ($got, $module->VERSION);
+ } else {
+ return
+ }
}
sub check_kpsewhich {
my ($module, %role) = @_;
my $line = "Looking for $module->{fullname}";
- my $res = SL::InstallationCheck::module_available($module->{"name"}, $module->{version});
- print_result($line, $res);
+ my ($res, $ver) = SL::InstallationCheck::module_available($module->{"name"}, $module->{version});
+ if ($res) {
+ print_line($line, $ver || 'no version', 'green');
+ } else {
+ print_result($line, $res);
+ }
+
return if $res;
sub print_result {
my ($test, $exit) = @_;
- print $test, " ", ('.' x (72 - length $test));
- print $exit ? '.... '. mycolor('ok', 'green') : ' '. mycolor('NOT ok', 'red');
+ if ($exit) {
+ print_line($test, 'ok', 'green');
+ } else {
+ print_line($test, 'NOT ok', 'red');
+ }
+}
+
+sub print_line {
+ my ($text, $res, $color) = @_;
+ print $text, " ", ('.' x (78 - length($text) - length($res)));
+ print mycolor($res, $color);
print "\n";
return;
}