summaryrefslogtreecommitdiffstats
path: root/lib/OpenSLX/Basics.pm
diff options
context:
space:
mode:
authorOliver Tappe2008-03-23 15:29:41 +0100
committerOliver Tappe2008-03-23 15:29:41 +0100
commit1652dd263dc318b27da384609b7d111f495dd382 (patch)
tree4aab243eab3f73945b9dea7eecc6a54f586e0e24 /lib/OpenSLX/Basics.pm
parent* no longer asks for root password upon install (will be done as a plugin later) (diff)
downloadcore-1652dd263dc318b27da384609b7d111f495dd382.tar.gz
core-1652dd263dc318b27da384609b7d111f495dd382.tar.xz
core-1652dd263dc318b27da384609b7d111f495dd382.zip
* added sigtrap protection (against user pressing CTRL-C, for instance) and made
sure that any pending cleanup functions are invoked upon unload of module * some formatting corrections git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1676 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'lib/OpenSLX/Basics.pm')
-rw-r--r--lib/OpenSLX/Basics.pm33
1 files changed, 21 insertions, 12 deletions
diff --git a/lib/OpenSLX/Basics.pm b/lib/OpenSLX/Basics.pm
index fab5554a..230bf72b 100644
--- a/lib/OpenSLX/Basics.pm
+++ b/lib/OpenSLX/Basics.pm
@@ -35,6 +35,7 @@ $VERSION = 1.01;
our (%openslxConfig, %cmdlineConfig, %openslxPath);
+use sigtrap qw( die normal-signals error-signals );
use subs qw(die warn);
use open ':utf8';
@@ -42,7 +43,7 @@ use open ':utf8';
################################################################################
### Module implementation
################################################################################
-require Carp; # do not import anything as we are going to overload carp
+require Carp; # do not import anything as we are going to overload carp
# and croak!
use Carp::Heavy; # use it here to have it loaded immediately, not at
# the time when carp() is being invoked (which might
@@ -166,13 +167,15 @@ sub openslxInit
GetOptions(%openslxCmdlineArgs);
# try to read and evaluate config files:
- my $configPath = $cmdlineConfig{'config-path'}
- || $openslxConfig{'config-path'};
+ my $configPath
+ = $cmdlineConfig{'config-path'} || $openslxConfig{'config-path'};
my $sharePath = "$openslxConfig{'base-path'}/share";
my $verboseLevel = $cmdlineConfig{'verbose-level'} || 0;
- foreach my $f ("$sharePath/settings.default", "$configPath/settings",
- "$ENV{HOME}/.openslx/settings")
- {
+ foreach my $f (
+ "$sharePath/settings.default",
+ "$configPath/settings",
+ "$ENV{HOME}/.openslx/settings"
+ ) {
next unless -e $f;
if ($verboseLevel >= 2) {
vlog(0, "reading config-file $f...");
@@ -207,12 +210,12 @@ sub openslxInit
if (defined $openslxConfig{'logfile'}) {
open($openslxLog, '>>', $openslxConfig{'logfile'})
- or croak(
- _tr(
- "unable to append to logfile '%s'! (%s)",
- $openslxConfig{'logfile'}, $!
- )
- );
+ or croak(
+ _tr(
+ "unable to append to logfile '%s'! (%s)",
+ $openslxConfig{'logfile'}, $!
+ )
+ );
}
if ($openslxConfig{'verbose-level'} >= 2) {
foreach my $key (sort keys %openslxConfig) {
@@ -633,4 +636,10 @@ sub instantiateClass
return $class->new;
}
+# ------------------------------------------------------------------------------
+END
+{
+ invokeCleanupFunctions() if %cleanupFunctions;
+}
+
1;