Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: Can I have a Perl script, initiated from a browser, fork itself, and not wait for the child to end?

by cavac (Parson)
on Apr 07, 2022 at 06:52 UTC ( [id://11142776] : note . print w/replies, xml ) Need Help??


in reply to Re^2: Can I have a Perl script, initiated from a browser, fork itself, and not wait for the child to end?
in thread Can I have a Perl script, initiated from a browser, fork itself, and not wait for the child to end?

There's a lot to go through there, but I am trying to avoid the CRON path. Just seems kludgy to me

Not really. If you need something to run independent from webcalls, that's how you should design it. One way of avoiding CRON would be to have a background process that always runs and get's controlled from the CGI scripts via interprocess messaging. There are many, many solutions on how to do this. As the author of the Net::Clacks module, this is what i usually recommend (since then i would be able to help you if you run into problems). There's a slightly outdated Howto on PM, see Interprocess messaging with Net::Clacks, and the package comes with some example programs as well.

perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'