Like grandfather says, generate some representative sample data (mock data), then write a test suite around the mock data, and put it into version control
Once you have mock data and test suite, its time to refactor, more on this in What is the best way to add tests to existing code?, Re: Idiomize This - Cleanup/Transform, Re: Moose and Antlers!, Re: Splitting a project into smaller files, Re^3: A question about web service security, Re: What CPAN Modules are Good to Learn From?, Developing a module, how do you do it ?
The actual framework you choose ( Catalyst or Badger Power ... ) is not that important, what is important is making functions , documenting what they do, making sure they work as documented, making sure the program (the public interface ) works the same -- basics of maintainability