Prayer comes to mind. (What else did you expect at the Monastery? ;-)
Seriously, here's a few tips.
- Try to break it up into pieces. Even if it's not in subs, make a copy of the original, and start ripping out lines. Once you have some manageable chunks, you'll be able to figure it out more easily.
- Make a version that doesn't do any database calls at all. You don't mention whether it's using DBI; in any case, it has to be calling something to execute SQL. Substitute an "execute_sql" routine that just prints out the string that was passed in.
- Learn to use the Perl debugger real well real fast.... Use it to test expressions you don't understand by typing them in and seeing what they do.
- Personally, I wouldn't bother with the UML diagrams. They're great for design, but I've never found them useful for reverse engineering. But that's just me.
Prayer may not be a bad idea, actually....
HTH