This is kind of an embarrassing one. I'm sure I must be missing something obvious.
I have a Catalyst based website running in mod_perl.
There are two versions of the website, let's call them old and new (new was cloned from a remote git repo to the server, could that be causing the problem?)
The website works when the directory /var/www is symlinked to old, as in
ln -s /path/to/old /var/www
The website does not work when the directory /var/www is symlinked to new, as in
(removing the old link first of course).ln -s /path/to/new /var/www
The reason it doesn't work, seen in apache error logs, is that it can't find the custom perl modules in /path/to/new. It says it can't find them in @INC and that @INC contains /var/www and /var/www/whatever/lib/Module/etc which is correct
When I remove that symlink and re-link /path/to/old it works just fine.
If I do perl -I/path/to/new -MSome::Module::In::New there's no problem, it finds the module just fine.
I've checked permissions and made sure they're the same, or even less restrictive on the files in /path/to/new. The relative paths are all correct, as far as I can see my /path/to/old and /path/to/new directories are exactly the same, except that apache/mod_perl can see one and not the other.
This is on an Amazon EC2 running linux by the way.