I've just learned of a situation where, do to an unfortunate lack of communication between a website owner and the server admins, the site owner has a copy of all of the PHP for his site but none of the MySQL tables that the site used. In order to make the site functional again someone just needs to read through the PHP and reconstruct an empty database to fit the code. I haven't seen the application yet, but I don't think it is too complex so it probably isn't a very difficult or time consuming project. However, it got me thinking: is it possible to write a program that would parse PHP or Perl code and automatically generate the SQL necessary to construct the database the PHP or Perl was expecting? It seems like an interesting project to me. My first thought is that one way to tackle it in Perl would be to write a DBD driver that intercepted calls to the database, checked for appropriate tables and columns, and created them if necessary.