I am doing almost the same, I wrote a class for error logging and use it extensively. For my module now I will give a try with your '$Debug' variable to drive the error-logging mechanism as its a fast way for exploring the data ;-)

Thanks a lot!
Tobias

Comment on Re^4: package variables turning suddenly to undef and back again depending on subfunction call