diff options
Diffstat (limited to 'lib/OpenSLX/DistroUtils/Engine.pm')
-rw-r--r-- | lib/OpenSLX/DistroUtils/Engine.pm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/OpenSLX/DistroUtils/Engine.pm b/lib/OpenSLX/DistroUtils/Engine.pm new file mode 100644 index 00000000..5482f1d2 --- /dev/null +++ b/lib/OpenSLX/DistroUtils/Engine.pm @@ -0,0 +1,30 @@ +package OpenSLX::DistroUtils::Engine; + +use OpenSLX::Basics; + +sub new +{ + my $class = shift; + my $self = {}; + return bless $self, $class; +} + + +sub loadDistro { + my $self = shift; + my $distroName = shift; + + my $distro; + my $loaded = eval { + $distro = instantiateClass("OpenSLX::DistroUtils::${distroName}"); + return 0 if !$distro; # module does not exist, try next + 1; + }; + + if (!$loaded) { + $distro = instantiateClass("OpenSLX::DistroUtils::Base"); + } + return $distro; +} + +1;
\ No newline at end of file |