in reply to Re^2: multiprocessing in perl
in thread multiprocessing in perl

how can I use clone() to resolve this problem.

Unfortunately, that means that the DBD driver would need, possibly extensive modifications. Which unless you are well versed in DBD internals, you should probably leave to the authors.

However, perhaps you can turn things around and put the long running part in a thread, and ping the DB from the main thread like so (also untested):

use threads; use threads::shared; $dbh = $conn->databaseHandle();# I am calling this from my connection +class print "dbh: ". $dbh."\n"; my $done :shared = 0; async { # system 'yourLongRunningCmd'; &long_running_script; $done = 1; }->detach; $dbh->ping while !$done and sleep 15; ## Adjust frequency to suit print "Thread disappears..Done"; exit; sub long_running_script { print "Testing... long_running test is beign called. will sleep fo +r 30 sec\n"; sleep(30); }

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^4: multiprocessing in perl
by shijumic (Novice) on Apr 16, 2009 at 17:33 UTC
    Thanks much, I used fork insted of threads and it works fine..