Hello! Each time I build a Catalyst application I come to a point where the application gets painfully slow to (re)start, the delay is about 10 seconds. Today I figured the delay is caused by the following lines:
use lib '/home/zoul/opt/lib/perl/5.8';
use lib '/home/zoul/opt/share/perl/5.8';
use lib '/home/zoul/opt/lib/perl/5.8.8';
use lib '/home/zoul/opt/share/perl/5.8.8';
These lines are only needed on the server, since I haven’t got root access there and have my Perl modules installed under ~/opt
. (I can’t use Apache’s SetEnv
module, since the hoster does not support it. Therefore I have to enter the library paths into App.pm
.) On my development machine that exhibits the gory delay the paths do not exist.
My questions: (1) Why do the lines cause so much delay, about 7 seconds? (2) What’s a nice way to solve this? Naive conditional use
does not work:
if ($on_the_hosting_machine)
{
use lib '…';
}
I guess I could eval
somehow, or is there a better way?