Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: How can I run a piece of code asyncronously in Perl?

by Doctrin (Beadle)
on Nov 02, 2012 at 19:43 UTC ( #1002034=note: print w/ replies, xml ) Need Help??


in reply to Re: How can I run a piece of code asyncronously in Perl?
in thread How can I run a piece of code asyncronously in Perl?

Thanks. I'm sure it would work, but, if t2.pl would execute, say, in 0.1 sec, and the code in t1.pl would execute in 2.0 sec - it won't work (( Thread would be terminated, I suppose (( I need t1.pl to run completely independently of t2.pl which calls it...


Comment on Re^2: How can I run a piece of code asyncronously in Perl?
Re^3: How can I run a piece of code asyncronously in Perl?
by BrowserUk (Pope) on Nov 02, 2012 at 20:04 UTC
    t won't work... Thread would be terminated, I suppose.

    Why "suppose"? Did you try it?

    C:\test>perl -Mthreads -E"async{ qx{perl -E\"sleep 5; die q[Now I'm do +ne];\"} }->detach; select'','','',0.1; die 'I\'m done'" I'm done at -e line 1. C:\test>Now I'm done at -e line 1.

    So long as you give the thread chance to start the command running, it will complete even if the thread dies.

    Ie. "t1.pl runs completely independently of t2.pl".

    It's probably not how I would do it; but then 'it' -- as you've defined it so far -- is so completely pointless, I probably wouldn't do it at all.

    But if I did, on Windows I'd probably use system 1, 't1.pl arg1 arg2 arg3';


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    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.

    RIP Neil Armstrong

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002034]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2014-07-31 02:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (244 votes), past polls