I have a big perl script (about 650 lines) that parses data off imdb.com, tvrage.com and can get data using last.fm API, and a few other sites. This script uses quite a few Perl modules so it takes a few seconds to load (on an old PC). What are the different ways (including any 'ugly hacks') in which the script can be sent quickly to the background?
I'll start with a few that I know of.
- Run the script as
script.pl &
- Run the script as
screen -dmS script.pl
- Use
fork()
inside the script - Use App::Daemon or Proc::Fork
The problem with 3 and 4 is that when the script is large (like 500 to 600 lines) and uses a lot of modules, it takes some time for the process to fork and sent to background. With #1 and #2, they're instantly sent to background so I'm looking for more solutions like these.
Note: I do not need to get any data from the background process. They're writing to file. I also do not need to know if the background process completed its task successfully or not.