Posts tagged: tiresome

Dotcloud and Perl Versions

Today I waste all my afternoon trying to solve a problem with Perl versions and DotCloud. I say I wasted the afternoon because I could not solve the issue during the afternoon, only in the beginning of the night.

Enough complain, and let me explain what was going on. Yes, this post is a little as a complain to the DotCloud tech guys, but also as a guide to someone that stumble in a similar situation.

I had a service running with Dancer. It worked, it connected perfectly to the database. Next step was to set up a cron job to fetch some data from the Web. I added its dependencies in the Makefile.PL file for the website, and hoped that the deploy system would install them. But the cron job continued failing. I tried to force its installation, but the deploy system said it was up to date. Something wrong was going on. I forced a little more the installation, adding the URL to the module tarball. This way the deploy system could not guess its version, and therefore, would install the module anyway. It worked, but the deploy system continued complaining about other and other module.

It got stranger when the cron job complained about the lack of the DBI module. Hey, how can it be, if the website is running and using it? Well, DBI is based on C code, so probably I am missing to include a sub-folder of the local module installation. And then, it got clearer: the cron job complained that the version of could not be loaded into Perl because of unresolved symbols. Aha! Then, there are two Perl versions.

And indeed, the web application was running Perl 5.14.x (I requested it on my DotCloud configuration file) and the Perl used by the cron job was Perl 5.10.x. Basically, DotCloud folks keep the system Perl, and install custom Perl versions under /opt/perl5, and creates some symlinks there, so that /opt/perl5/perls/current points to the Perl version requested.

So, the solution is to make the cron job use the correct Perl version. In my case I set the full path, but you could change the PATH environment variable in your .bashrc-like file.

This wasn’t that hard, but it was quite time consuming, because deploys take some time. Probably I could get faster if I remembered to test Perl versions right ahead, but I forgot to.

I suggest DotCloud guys to do one of two things: or document this in the same doc where it is explained how to request a specific Perl version, or fix the damn environment so that cron jobs and other code uses the same Perl version as the one requested by the system.