Converting M,V,C Directories

Let's face it. You want to be cool. You don't like code telling you that you are deprecated. That's not going to cut it. Well, you're in luck, moving from the Slap Bracelet cool MVC directories to the cooler Model, View, and Controller directory structure for your Catalyst App couldn't be easier.

Clean Up

  • Make sure you check in all of your changes to whichever VCS you're using.
  • If you're not using VCS, start now.

    (This write up uses SVN, git users do git things instead)

Break Everything

Move the directories, make sure you use your VCS tool to move the directories so your meta-data isn't foobar'd.

$ cd myapp/lib/myapp
$ svn mv M Model
$ svn mv V View
$ svn mv C Controller

Fix Everything

I have a small number of *.pm files, so it wasn't a headache to just manually edit the files and do a replace in vim:

 # in vim
 :%s/M::/Model::/g
 :%s/V::/View::/g
 :%s/C::/Controller::/g

Do that for each *.pm in lib/ and each file in t/. You can script it too, I'm lazy and didn't need to.

Test Your App

If this is live testing and you're using Catalyst::Plugin::Session, any old sessions will have to be deleted. The old session objects in the Store will be referencing you non-existant MyApp::M::DB::Session or whatever.

Commit

Commit the changes to your VCS to ensure your prosperity.

$ svn ci

Profit

All you have to do is convince 5 of your friends to join in. If they convince 5 of their friends, who convince another 5, you'll make 6 Billion USD / second.

My tags:
 
Popular tags:
 
Powered by Catalyst
Powered by MojoMojo Hosted by Shadowcat - Managed by Nordaaker