summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOliver Tappe2007-05-07 18:05:06 +0200
committerOliver Tappe2007-05-07 18:05:06 +0200
commit63320537aaebc55a1f2125e88f07e461c0149622 (patch)
tree34e23f9fde09167bc799fea72bfe1e4bb4a005de /lib
parent* minor cleanup with respect to how slxldd is invoked (diff)
downloadcore-63320537aaebc55a1f2125e88f07e461c0149622.tar.gz
core-63320537aaebc55a1f2125e88f07e461c0149622.tar.xz
core-63320537aaebc55a1f2125e88f07e461c0149622.zip
* moved instantiateClass() from OpenSLX::Utils to OpenSLX::Basics
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1023 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'lib')
-rw-r--r--lib/OpenSLX/Basics.pm24
-rw-r--r--lib/OpenSLX/Utils.pm24
2 files changed, 25 insertions, 23 deletions
diff --git a/lib/OpenSLX/Basics.pm b/lib/OpenSLX/Basics.pm
index 9cca7b8c..998e7982 100644
--- a/lib/OpenSLX/Basics.pm
+++ b/lib/OpenSLX/Basics.pm
@@ -25,6 +25,7 @@ $VERSION = 1.01;
&_tr &trInit
&warn &die &executeInSubprocess &slxsystem
&vlog
+ &instantiateClass
);
use vars qw(%openslxConfig %cmdlineConfig);
@@ -360,4 +361,27 @@ sub die
}
}
+# ------------------------------------------------------------------------------
+sub instantiateClass
+{
+ my $class = shift;
+ my $requestedVersion = shift;
+
+ unless (eval "require $class") {
+ if ($! == 2) {
+ die _tr("Class <%s> not found!\n", $class);
+ } else {
+ die _tr("Unable to load class <%s> (%s)\n", $class, $@);
+ }
+ }
+ if (defined $requestedVersion) {
+ my $classVersion = $class->VERSION;
+ if ($classVersion < $requestedVersion) {
+ die _tr('Could not load class <%s> (Version <%s> required, but <%s> found)',
+ $class, $requestedVersion, $classVersion);
+ }
+ }
+ return $class->new;
+}
+
1;
diff --git a/lib/OpenSLX/Utils.pm b/lib/OpenSLX/Utils.pm
index ef4c1cac..d86167a2 100644
--- a/lib/OpenSLX/Utils.pm
+++ b/lib/OpenSLX/Utils.pm
@@ -21,7 +21,7 @@ $VERSION = 1.01;
@ISA = qw(Exporter);
@EXPORT = qw(
- &copyFile &fakeFile &linkFile &slurpFile &instantiateClass
+ &copyFile &fakeFile &linkFile &slurpFile
);
################################################################################
@@ -86,26 +86,4 @@ sub slurpFile
return $text;
}
-sub instantiateClass
-{
- my $class = shift;
- my $requestedVersion = shift;
-
- unless (eval "require $class") {
- if ($! == 2) {
- die _tr("Class <%s> not found!\n", $class);
- } else {
- die _tr("Unable to load class <%s> (%s)\n", $class, $@);
- }
- }
- if (defined $requestedVersion) {
- my $classVersion = $class->VERSION;
- if ($classVersion < $requestedVersion) {
- die _tr('Could not load class <%s> (Version <%s> required, but <%s> found)',
- $class, $requestedVersion, $classVersion);
- }
- }
- return $class->new;
-}
-
1; \ No newline at end of file