I've been assigned to pick up a webapplication written in some old Perl Legacy code, get it working on our server to later extend it. The code was written 10 years ago by a solitary self-taught developer...
The code has weird stuff going on - they are not afraid to do lib-param.pl
on line one, and later in the file do /lib-pl/lib-param.pl
- which is offcourse a different file.
Including a.pl
with methods b()
and c()
and later including d.pl
with methods c()
and e()
seems to be quite popular too... Packages appear to be unknown, so you'll just find &c() somewhere in the code later.
Interesting questions:
- Is there a tool that can draw relations between perl-files? Show a list of files used by each other file?
- The same for MySQL databases and tables? Can it show which schema's/tables are used by which files?
- Is there an IDE that knows which c() is called - the one in a.pl or the one in d.pl?
- How would you start to try to understand the code?
I'm inclined to go through each file and refactor it, but am not allowed to do that - only the strict minimum to get the code working. (But since the code never uses strict
, I don't know if I'm gonna...)