[Pdx-pm] Converting a monolithic program to mvc

Phred Bob phredbob at hotmail.com
Thu Jun 10 11:17:12 PDT 2010


I am trying to take a monolithic perl program (approx. 97k lines long)
and separate concerns (kind of an MVC-style division). I used AutoSplit
to break out the subroutines, but now I'm stuck. I tried separating
the *.al subroutines into a View directory if they contained a print
statement and into a Model directory if they didn't. The main part of
the program (before __END__) is about 4.6k lines that I am tentatively
making the Controller.

So -- the autoload works as long as the the files are left in the state
in which were originally generated (a bunch of .al files all in one
directory). That still leaves me with about 191 separate files with no
classification on them, so I'd like to organize them in further
subdirectories to correspond with my separation of them into models,
views, and a controller.

The problem is, if I move them, my autoload function no longer works.
And if I do put them in a subdirectory and load them as modules, they
use their own namespace and ignore all the lovely global variables the
original developer put in his vast, monolithic script. 

Does anyone have any ideas on how to proceed?


Fred Lowephredbob at hotmail.com 		 	   		  
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/pdx-pm-list/attachments/20100610/9104d858/attachment.html>

More information about the Pdx-pm-list mailing list