Categories
Uncategorized

X debug trick

A useful tip I found in work today for debugging deeply embedded stuff. I was in the middle of some Perl tests talking to a PostgreSQL database. The database was created at the start of the test, and dropped at the end of the test, so there was no oppurtunity to see inside it whilst the test was running.

I remembered seeing an X trick in postfix and realised I could do something similiar. So I came up with this.

system "xterm -e psql -d $ENV{DBNAME}";

I put that in my function where I wanted to examine the database. When the line ran, I got a nice new window all ready for me to inspect that database. Needless to say, it quickly revealed the problem in my code…