Skip to content

Commit 8b5e270

Browse files
Add a conditional debug print clause
1 parent 3a0ec64 commit 8b5e270

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

diff-so-fancy

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,4 +1086,21 @@ sub debug_log {
10861086
return 1;
10871087
}
10881088

1089+
# Enable k() and kd() if there is a DSF_DEBUG environment variable
1090+
BEGIN {
1091+
if ($ENV{"DSF_DEBUG"}) {
1092+
require Data::Dump::Color;
1093+
*k = sub { Data::Dump::Color::dd(@_) };
1094+
*kd = sub {
1095+
k(@_);
1096+
1097+
printf("Died at %2\$s line #%3\$s\n",caller());
1098+
exit(15);
1099+
}
1100+
} else {
1101+
*k = sub {};
1102+
*kd = sub {};
1103+
}
1104+
}
1105+
10891106
# vim: tabstop=4 shiftwidth=4 noexpandtab autoindent softtabstop=4

0 commit comments

Comments
 (0)