in reply to Re: use lib "."
in thread use lib "."
As already pointed out, cron provides a very limited environment
That explains the odd behaviour I discovered after posting the question...
It worked as expected when executed over SSH where the CGI environment variables are still missing.
To avoid problems, I typically use absolute paths everywhere in a cron script.
That's how I've solved it - at least I think I've solved it. I won't know for sure until the cron job runs tomorrow morning. Now the maintenance script has an absolute path passed to lib so there are no relative issues to deal with.
I'm not sure whether this is a better approach than using FindBin?
A lib directory is fairly standard for Perl modules; it is not standard for scripts. A bin directory is more usual for *.sh, *.pl, and so on. I'll leave you to decide if you wish to make a change.
See my reply to hippo at Re^2: use lib "."
I'd be interested in your view of having a bin or cron directory when there is only a single script outside the www directory...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: use lib "."
by kcott (Archbishop) on Aug 12, 2023 at 19:32 UTC | |
by Bod (Parson) on Aug 12, 2023 at 19:37 UTC |