Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Refactor CGI::Application and supporting scrits

by sundialsvc4 (Abbot)
on Apr 04, 2013 at 15:50 UTC ( #1027006=note: print w/replies, xml ) Need Help??

in reply to Refactor CGI::Application and supporting scrits

It is, unfortunately, very hard to make categorical statements about “what should be done” with a poorly-organized legacy application like this one.   (Dealing with stink-pots is a lot of what i do.)   The biggest gotcha that is going to warrant a lot of careful investigation is ... those AJAX-driven but individual scripts.   You need to figure out exactly how they are being invoked, and how they contribute output to be sent back as part of the reply stream.   Anything goes as to what you might find here, and the thing that you must hope you will not find is “namespace collisions” of any sort between them.   A traditional CGI application is a one-shot:   the designer knows that it will receive the request, then somehow gather-together the right bits of code to handle it, then handle it, then go-away.   If the requests are packaged as individual Perl scripts as you say, presumably only one of them would be loaded at a time so conflicts between them would not be an issue.   If you now seek to assemble them into one file, you could well be changing the situation in a way that your (hapless...) predecessor did not bother to consider before s/he split town, because now all of those modules will be loaded at the same time.

I would suggest starting with a very careful inventory of the entire application, looking at each and every one of those independent files to ascertain the commonality between them ... and how they might conflict with one another if brought into one file.   You definitely need to understand how the dispatching mechanism works right now ... presumably a CGI::App “run mode” gets you as far as “ajax” and one module takes it from there ... somehow.   As you seek, then, to re-factor this thing to use a more intelligent strategy, you also must consider a way to do it in stages, not all-or-nothing.   The monstrosity somehow has to remain in-service the entire time it is being rehabilitated.

You probably should figure out some way to set up a test-machine pointing to a test-database, and look at Selenium or a similar web-GUI testing mechanism so that you can verify automatically that the functionality of the total site is not being interrupted by any of your changes.

  • Comment on Re: Refactor CGI::Application and supporting scrits

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1027006]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2018-04-23 22:14 GMT
Find Nodes?
    Voting Booth?