From 587a7a37f8abb4bea89e9fc669b787bc998ede86 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Mon, 30 Apr 2007 21:29:01 +0000 Subject: * improved die() and warn() to fall back to the respective CORE-functions unless croaking has been requested. git-svn-id: http://svn.openslx.org/svn/openslx/trunk@970 95ad53e4-c205-0410-b2fa-d234c58c8868 --- lib/OpenSLX/Basics.pm | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/OpenSLX/Basics.pm b/lib/OpenSLX/Basics.pm index 3159afa0..6a23d8c0 100644 --- a/lib/OpenSLX/Basics.pm +++ b/lib/OpenSLX/Basics.pm @@ -37,7 +37,7 @@ use Carp::Heavy; # use it here to have it loaded immediately, not at the time when # carp() is being invoked (which might be at a point in time where # the script executes in a chrooted environment, such that the module - # can't be loaded anymore). + # can't be loaded anymore). use FindBin; use Getopt::Long; use POSIX qw(locale_h); @@ -329,13 +329,13 @@ sub slxsystem sub warn { my $msg = shift; + $msg =~ s[^\*\*\* ][]igms; + $msg =~ s[^][*** ]igms; if ($openslxConfig{'croak'}) { - print STDERR "*** "; carp $msg; } else { - $msg =~ s[^][*** ]igms; chomp $msg; - print STDERR "$msg\n"; + CORE::warn "$msg\n"; } } @@ -343,15 +343,13 @@ sub warn sub die { my $msg = shift; + $msg =~ s[^\*\*\* ][]igms; + $msg =~ s[^][*** ]igms; if ($openslxConfig{'croak'}) { - print STDERR "*** "; croak $msg; } else { - $msg =~ s[^][*** ]igms; chomp $msg; - print STDERR "$msg\n"; - exit 5 unless ($!); - exit $!; + CORE::die "$msg\n"; } } -- cgit v1.2.3-55-g7522