|We don't bite newbies here... much|
Best way to fix a broken but functional program?by idnopheq (Chaplain)
|on Aug 22, 2001 at 22:03 UTC||Need Help??|
idnopheq has asked for the
wisdom of the Perl Monks concerning the following question:
I am plagued, PLAGUED I said, by a bit of perl exceeding 4K lines, where 'use strict;' and '-w' were actively avoided. Not only that, the program is replete w/ symbolic references, vars never accessed, subs called in void contexts, the Holy texts never consulted, no external modules used, and - as a result - the wheel is reinvented poorly more times than the Yankees have World Series titles. Enabling warnings, strict, *or* diagnostics overflow my scrollback buffer.
I want to laugh at it, but my incescent sobbing gets in the way. On top of it all, my girlfriend won't let me bitch about it anymore ( I'm amazed at how much bitching can be fit into a 36 hour period! ).
My query is 'How to I begin knocking this damn thing into shape?'. Of course, some suit made this huge CRAWLING HORROR, nay WOMBAT, mission critical, and the unstable mind that brought this monstrosity into the world is no longer with us ( in more ways than one, RIP! HHOS ). The folks running either end are third generation and don't know how this works, either. Thus, I inherrited this damnable thing and it's the glue somehow.
The thing stinks slightly of PASCAL, too.
Via vgrep, I cannot certainly discern what the script does, but we've proven we need it to function in our e-commerce app. Best I can tell it querries data from a VAXen or two based off of some kind of mangled pre-SQL query from an HTML text box and kicks a job off to some knock-off Win32 app. The inputs and outputs are unclear at best, though analysis of the tcpdump output may reveal something.
Were it elegant but obfuscated, that would be one thing. But it looks so nasty that I think it was writen in M$ Notepad ( except for the length ). I cannot post it, as it may or may not divulge secrets into life, the universe, and everything. So, I am looking for methodology.
So far, I've devised:
I'm guessing at least a month to fully nurse this thing to what I consider health and continue with my normal duties, but is there an easier way to do it? I don't normally look for a magic spell to fix a problem, but I dunno what else to do. Granted, I have EMACS and the ever so lovely cperl-mode to help me through formatting, highlighting, and the imenu, but I've not tackled something so monsterous and ugly before. I fear fixing it to the point it no longer works.
Advice from the more proficient or those who have tackled something like this is most appreicated and solicited. BTW, I did do a Super Search and some Googling, but nothing truly satisfactory was returned ... did I miss something?