Here are my suggestions...
Add a log function:
Then, at the beginning and end of each sub-routine, add:sub log { open (LOG,">>log") || die $!; print LOG "$_[0]\n"; close LOG; }
Then add various log calls when things happen that you're unsure of, tacking vars used. eg:sub sub-name { log("Entering sub-name"); ... log("Leaving sub-name"); }
Adding some vars fom caller() may also give you some added insight.log("querying VAX: $vaxen_query"); execute $vaxen_query; log("SQL query: $mangled_sql_query"); execute $mangled_sql_query;
Once you have some idea what gets sent where and when, you can replan what the scipt does and rewite cleanly.
HTH
cLive ;-)
In reply to Re: Best way to fix a broken but functional program?
by cLive ;-)
in thread Best way to fix a broken but functional program?
by idnopheq
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |