multithreading - Safe fire and forget method in Perl -


i need execute method (not process) asynchronously in perl code, must ensure code never raise exception , stop main task execution.

what best way call method asynchronously , silencing potential exception whether called method internal exception whether threading exception?

in java had this:

// task runs here try {     // assyncrounous method invocation (fire , forget)     new mythread().start(); } catch (throwable e) {     // silent error } // task continues here 

you have 2 options if want execute arbitrary code asynchronously: can run in separate process, or can run in separate thread. using separate process make more robust, use thread.

use threads; $thread = async { code() }; 

join thread wait finish.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -