summaryrefslogtreecommitdiffstats
path: root/lib/OpenSLX/Basics.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/OpenSLX/Basics.pm')
-rw-r--r--lib/OpenSLX/Basics.pm19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/OpenSLX/Basics.pm b/lib/OpenSLX/Basics.pm
index 9c5b0b6c..b1e052a4 100644
--- a/lib/OpenSLX/Basics.pm
+++ b/lib/OpenSLX/Basics.pm
@@ -15,7 +15,7 @@ $VERSION = 1.01;
@EXPORT = qw(
&openslxInit %openslxConfig %cmdlineConfig
- &_tr &trInit
+ &_tr &trInit die
&vlog
);
@@ -29,6 +29,8 @@ use FindBin;
use Getopt::Long;
use POSIX qw(locale_h);
+my $DEBUG = 0;
+
my %translations;
# this hash will hold the active openslx configuration,
@@ -271,4 +273,19 @@ sub _tr
return sprintf($formatStr, @_);
}
+# ------------------------------------------------------------------------------
+sub die
+{
+ my $msg = shift;
+ if ($DEBUG) {
+ print STDERR "*** ";
+ croak $msg;
+ } else {
+ $msg =~ s[^][!!! ]igms;
+ chomp $msg;
+ print STDERR "$msg\n";
+ exit $!;
+ }
+}
+
1; \ No newline at end of file