From: Florian Ragwitz Date: Tue, 28 Jul 2009 06:25:03 +0000 (+0200) Subject: Make DD_DEBUG handling more robust. X-Git-Tag: 0.005008~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=87195072373ca1f3380381c4aba54afeaa82f0df;p=p5sagit%2FDevel-Declare.git Make DD_DEBUG handling more robust. --- diff --git a/Declare.xs b/Declare.xs index c3a8dee..54aa668 100644 --- a/Declare.xs +++ b/Declare.xs @@ -134,7 +134,7 @@ void dd_set_linestr(pTHX_ char* new_value) { PL_bufend = SvPVX(PL_linestr) + new_len; - if ( DD_DEBUG_UPDATED_LINESTR && PERLDB_LINE && PL_curstash != PL_debstash) { + if ( DD_DEBUG_UPDATED_LINESTR && PERLDB_LINE && PL_curstash != PL_debstash) { // Cribbed from toke.c SV * const sv = NEWSV(85,0); @@ -488,6 +488,11 @@ set_in_declare(int value) in_declare = value; BOOT: - if (getenv ("DD_DEBUG")) { - dd_debug = atoi(getenv("DD_DEBUG")); + char *endptr; + char *debug_str = getenv ("DD_DEBUG"); + if (debug_str) { + dd_debug = strtol (debug_str, &endptr, 10); + if (*endptr != '\0') { + dd_debug = 0; + } } diff --git a/t/debug.t b/t/debug.t index c0bf175..62b8721 100644 --- a/t/debug.t +++ b/t/debug.t @@ -15,7 +15,7 @@ open PERLDB, ">", "$Bin/../.perldb" or die "Cannot open $Bin/../.perldb: $!"; close PERLDB; $SIG{CHLD} = 'IGNORE'; -$SIG{ALRM} = sub { +$SIG{ALRM} = sub { fail("SIGALRM timeout triggered"); kill(9, $$); };