Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jplindstrom (594)

  (email not shown publicly)

Journal of jplindstrom (594)

Tuesday September 09, 2008
07:24 PM

You can get there from here - but it's the long way around

[ #37396 ]

Last week I spent some time refactoring the code base at work, moving configuration into the domain layer. Lots of editing, lots of moving around the code base. And waaay too much time spent chasing down specific files when moving things from DBIC/Mapper/ to Domain/, adding tests to domain/episode-general.t. You get the picture.

So that's a pattern. A 2d matrix of things in the code base. One dimension is the entities in the domain: Book, Person, Account. The other is the technical aspects they need to deal with: database tables, business logic, web request dispatch, templates, tests.

A project with an MVC structure usually ends up with the technical dimension (Model, View, Controller) at the top level in the directory tree, and then each of the M, V, C contain all of the the "things". There isn't always a 1:1:1 match between all of them, but often enough there is.

The project at work has even more technical aspects of most domain entities, because we support multiple input formats (and soon multiple output formats). Add tests to that and you have a big pile of files.

So how annoying was it to navigate up and down this directory tree all day long? A lot annoying is what it was.

But at least it's a structured pile of files. Certain files are next to each other, in the same directory. Other files have the same name, but are in different directories.

I ended up taking shortcuts, like switching to a file in the neighbourhood of where I was going and opening the file from there, so the cwd would be the correct one. But still very annoying.

So over the weekend I wrote File::Corresponding , to help me find related files. Basically an aid to navigate sideways in the directory tree, solving the problem described above.

A config file and a command line script you can shell out to from your editor of choise. And if your editor of choise is Emacs, I just made a release of Devel::PerlySense which incorporates this.

Since I just implemented the Emacs thing I haven't actually tried it out much yet, so it'll be interesting to see if it's actually useful :) If you decide to give it a spin, feel free to share your experience in the comments.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.