[Pdx-pm] Converting a monolithic program to mvc

Phred Bob phredbob at hotmail.com
Thu Jun 10 14:53:11 PDT 2010


Thanks benh,
I think that's what I may have to do,since I can't seem to find an easier way.
Fred 
> Date: Thu, 10 Jun 2010 12:01:33 -0700
> Subject: Re: [Pdx-pm] Converting a monolithic program to mvc
> From: ben.hengst at gmail.com
> 
> As Jeff and I found out last night you can create 'globals' (see
> below), it's not the cleanest thing that I've ever done but it works.
> 
> package one;
> use two;
> 
> $main::globalvar = { hello => 'Phred' };
> 
> my $two = two->new;
> 
> package two;
> print 'Hello ', $main::globalvar->{hello};
> 
> 2010/6/10 Phred Bob <phredbob at hotmail.com>:
> > Hi All,
> >
> > 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?
> >
> > Thanks,
> > Fred Lowe
> > phredbob at hotmail.com
> > ________________________________
> > The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with
> > Hotmail. Get busy.
> > _______________________________________________
> > Pdx-pm-list mailing list
> > Pdx-pm-list at pm.org
> > http://mail.pm.org/mailman/listinfo/pdx-pm-list
> >
> -- 
> benh~
> 
> http://three.sentenc.es/
 		 	   		  
_________________________________________________________________
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/pdx-pm-list/attachments/20100610/5c18f613/attachment.html>


More information about the Pdx-pm-list mailing list