in reply to Re^2: use lib "."
in thread use lib "."

Would you still use a cron directory even if you can be pretty sure there will only ever be this one script?

I would, yes. The only things I expect to see in the lib tree should be modules or POD files.


🦛

Replies are listed 'Best First'.
How many cron (was: Re^4: use lib ".")
by Bod (Parson) on Aug 13, 2023 at 09:50 UTC
    I would, yes

    Thanks hippo - on the advice of yourself and kcott my structure is getting changed as things are updated...

    On a similar topic, traditionally any cron tasks I had called the web script for that functionality which detected if it was running under cron or CGI by checking the $ENV{'DEFAULT_GATEWAY'} variable. More recently I have created separate scripts for each function that needs to run on cron.

    However, unless there is a different schedule, I am now grouping all that into one script.

    For example, I have a script that runs every morning that sends out emails on some days to users who have unread notifications and also sends emails to admins on other days to tell them about blogs that need reviewing. Plus, it does some daily tidying. Would you have a single script to deal with all the daily activities or multiple scripts?

      If the email work is similar enough (for "users who have unread notifications and also sends emails to admins on other days to tell them about blogs that need reviewing"), then keep that in a script. Or, have separate modules|functions in a package to do the emailing & create shorter, specific programs to use those modules.

      The "daily tidying" seems like should be separate task, in- or outside of cron.