+ printf LOG "%s %s\n", $date, $input;
+}
+
+sub debug_perl {
+ my ($str) = @_;
+
+ return unless ($str =~ /^WARN: Use of uninitialized value .* at (\S+) line (\d+)/);
+ my ($file,$line) = ($1,$2);
+ if (!open(IN,$file)) {
+ &status("WARN: cannot open $file: $!");
+ return;
+ }
+ binmode(IN, ":utf8");
+
+ # TODO: better filename.
+ open(OUT, ">>debug.log");
+ binmode(OUT, ":utf8");
+ print OUT "DEBUG: $str\n";
+
+ # note: cannot call external functions because SIG{} does not allow us to.
+ my $i;
+ while (<IN>) {
+ chop;
+ $i++;
+ # bleh. this tries to duplicate status().
+ # TODO: statcountfix
+ # TODO: rename to log_*someshit*
+ if ($i == $line) {
+ my $msg = "$file: $i:!$_";
+ printf "%s[%6d]%s %s\n", $_green, $statcount, $ob, $msg;
+ print OUT "DEBUG: $msg\n";
+ $statcount++;
+ next;
+ }
+ if ($i+3 > $line && $i-3 < $line) {
+ my $msg = "$file: $i: $_";
+ printf "%s[%6d]%s %s\n", $_green, $statcount, $ob, $msg;
+ print OUT "DEBUG: $msg\n";
+ $statcount++;
+ }
+ }
+ close IN;
+ close OUT;