in reply to Can I tell if DBI's quote() was used?

I agree with the others, you cannot really do what you are asking. I can't give you a silver bullet, but I can offer a process that might help.

I had a similar situation with a large amount of code that inconsistently referenced various schemas. Sometimes it was hard coded in the connect string, sometimes it was in a config file, sometimes it was hard coded in the SQL statements themselves, etc...

My approach was to build a bunch of regular expressions to filter the source code and pinpoint likely problem areas. In my case, I left all the legacy code in place so as not to break anything, then used the regex to change the schema between development and production database instances. Anything I found that I couldn't reliably manipulate with a regex got immediate priority for refactoring. It was a bit ugly, but it worked really, really well.

I literally started with regex's something like this:

/dbi\W+connect\(/i # grab every DBI connection call /(select)|(update)|(delete)/i # grab every thing that looks like SQL

Then I eyeballed the output for problem areas and patterns, refined the regex's to ignore some things & detect others, and repeated. Even though it was a large code base it didn't take too long to zero in on the true problem areas.

You can scan a lot of code very quickly this way, and that's basically what you will have to do. Using perl to scan perl source is really effective, and I'm sure there are modules out there to help.