You can make two separate scripts, one called by the crontab and one called by the CGI, let's say `cli.pl` and `index.pl`. They can call a common `do-my-work.pm` script with the business logic.
This will help you to separate the input params and the presentation in the calling scripts and the domain in the separate module. You can have the complete HTML or json output for the web call only in `index.pl`.
In reply to Re: How to distinguish a crontab call and a web call
by Popov
in thread How to distinguish a crontab call and a web call
by VK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |