Hi list,
I need to check the cause of a module loading error.
Currently I'm parsing the text of the thrown exception (see below). This
seems to work, but is there a more idiomatic way?
Best,
Simon
#!/usr/bin/env perl
use 5.020;
use warnings;
use strict;
use Module::Load;
my $module= 'AB::CD';
eval {
autoload($module);
};
if ($@) {
if ($@ =~ /Compilation failed in require/) {
say "compilation failed";
}
elsif ($@ =~ /Can't locate .* in \@INC/) {
say "module not found";
}
}
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/