summaryrefslogtreecommitdiffstats
path: root/lib/OpenSLX/Basics.pm
diff options
context:
space:
mode:
authorOliver Tappe2008-03-20 19:48:54 +0100
committerOliver Tappe2008-03-20 19:48:54 +0100
commit430f630238b3c17a8cfb962d034e70200c627ad8 (patch)
tree8223c370dcae4025b80d246acf83679e4e1cbf23 /lib/OpenSLX/Basics.pm
parent * fixed error on slxos-install (distro-info not found) (diff)
downloadcore-430f630238b3c17a8cfb962d034e70200c627ad8.tar.gz
core-430f630238b3c17a8cfb962d034e70200c627ad8.tar.xz
core-430f630238b3c17a8cfb962d034e70200c627ad8.zip
* improved error handling when trying to load plugin-specific distro modules (now
the actual error should be shown) git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1663 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'lib/OpenSLX/Basics.pm')
-rw-r--r--lib/OpenSLX/Basics.pm17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/OpenSLX/Basics.pm b/lib/OpenSLX/Basics.pm
index a9e017d2..fab5554a 100644
--- a/lib/OpenSLX/Basics.pm
+++ b/lib/OpenSLX/Basics.pm
@@ -602,8 +602,9 @@ sub instantiateClass
my $flags = shift || {};
checkParams($flags, {
- 'pathToClass' => '?',
- 'version' => '?'
+ 'acceptMissing' => '?',
+ 'pathToClass' => '?',
+ 'version' => '?',
});
my $pathToClass = $flags->{pathToClass};
my $requestedVersion = $flags->{version};
@@ -611,13 +612,15 @@ sub instantiateClass
my $moduleName = defined $pathToClass ? "$pathToClass/$class" : $class;
$moduleName =~ s[::][/]g;
$moduleName .= '.pm';
- unless (eval { require $moduleName } ) {
- if ($! == 2) {
+
+ if (!eval { require $moduleName } ) {
+ # check if module does not exists anywhere in search path
+ if (!-e $moduleName) {
+ return if $flags->{acceptMissing};
die _tr("Module '%s' not found!\n", $moduleName);
}
- else {
- die _tr("Unable to load module '%s' (%s)\n", $moduleName, $@);
- }
+ # some other error (probably compilation problems)
+ die _tr("Unable to load module '%s' (%s)\n", $moduleName, $@);
}
if (defined $requestedVersion) {
my $classVersion = $class->VERSION;