jhanna has asked for the wisdom of the Perl Monks concerning the following question:

This is a follow up to node Mysterious script crash in win2k

sub mlog { my $fh=shift; d(34); my $m=localtime(); $m=~s/^... (...) +(\d+) (\S+) ..(..)/$1-$2-$4 $3/; $m.= " $Con{$fh}->{ip} <$Con{$fh}->{mailfrom}>" if $fh && $Con{$fh}; $m.= " $_[0]\n"; print $m unless $silent; print DEBUG $m; if($logfile && open(LOG,">>$logfile")) {print LOG $m; close LOG;} }
I localized the last crash to this subroutine. d(34) printed 34 in the debug file, but the $m never appeared on the console, nor in the DEBUG log file (which is unbuffered), neither in the LOG file.

This means the program crashed inside localtime(), or doing a s/// regexp replace, or concatenating to a string ($m). The $_[0] parameter that was passed in was a string constant: 'local or whitelisted', and was called this way:

if(onwhitelist($fh,$this->{header})) { setmaillog(0,$fh); isnotspam($fh); mlog($fh,'local or whitelisted'); }
The setmaillog and isnotspam functions operated correctly and also affirm that $this is not corrupted.

Help! Something I'm doing is corrupting perl internally, and I don't know how to find that kind of bug!


P.S. Here's my perl's version:

This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2001, Larry Wall

Binary build 630 provided by ActiveState Tool Corp.
Built 20:29:41 Oct 31 2001