Commit b4bcdfa0 authored by Leigh B Stoller's avatar Leigh B Stoller

Add BackTraceOnWarning($onoff) to produce a backtrace on all warnings.

parent bbe51e15
......@@ -15,10 +15,11 @@ use vars qw(@ISA @EXPORT);
@EXPORT = qw(TBDB_CHECKDBSLOT_NOFLAGS TBDB_CHECKDBSLOT_WARN
TBDB_CHECKDBSLOT_ERROR TBcheck_dbslot TBFieldErrorString
TBGetUniqueIndex ParRun VersionInfo UpdateVersionInfo
SpanningTree);
SpanningTree BackTraceOnWarning);
use emdb;
use English;
use Carp;
#
# Support for checking field values against what is specified.
......@@ -599,5 +600,20 @@ sub SpanningTree($)
return @newedges;
}
#
# Toggle backtrace on warning.
#
sub BackTraceOnWarning($)
{
my ($enable) = @_;
if ($enable) {
$SIG{__WARN__} = sub { Carp::cluck(@_); };
}
else {
$SIG{__WARN__} = 'DEFAULT';
}
}
# _Always_ make sure that this 1 is at the end of the file...
1;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment