paperlined.org
dev > debugging_strategies
document updated 4 days ago, on Feb 16, 2025

debugging strategy — dump data to a specific file

In Perl, for instance, use something like Data::Dumper to write a short-ish bit of data to something like /tmp/app1.

In practice, if that script could possibly have multiple instances running at once (such as running as CGI script), then it helps to write it to /tmp/app1.$PID.

If /tmp/ has a ton of files in it, making it hard to find the ones you want, you could try writing to /tmp/$PROGRAMMER__NAME/app1.$PID, however, this complicates the code that dumps files out — now it must create the directory if it doesn't exist, and chmod 0777 the directory, just in case scripts running as different usernames will need to write to it.