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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.