CRON and packages

From Rabbi Blog

Read the extended for the story behind this. The easy fix for this was to append two back to back commands in cron:

cd /home/foca/public_html/cslog/p\&b && perl /home/foca/public_html/cslog/p\&b/

That way when CRON runs, it switches to the proper directory and then runs the script. Script checks the local directory and finds the module.

Breakfast time :-)

Earlier that morning...

Serves me right for trying to package it up and get it out yesterday morning before going to work. I need to look into either bringing the into the main script or figure out how a system handles cron runs in regards to relative/static paths. I want to avoid the end user needing to add anything to @INC if possible. The script works fine until I run the cron job on it:

Can't locate in @INC (@INC contains: (list of paths removed)
BEGIN failed--compilation aborted at /home/foca/public_html/cslog/p&b/ line 28.

So it works until you try to CRON it, which is the point of the script in the first place. I would like to stay away from needing to edit the main script for each update (i.e. hardcoding the install path).

If I check the path for @INC

-sh-3.00$ perl -e 'print join "\n", @INC'

I get a return for the current directory at the end.

-sh-3.00$ perl -e 'use ReadConfig'

That works from the shell, so my guess is that the issue stems from where the system runs CRON from and attempts to run ReadConfig from that current directory.