<?xml version="1.0" encoding="windows-1252"?>
<node id="1002044" title="Re^3: How can I run a piece of code asyncronously in Perl?" created="2012-11-02 16:04:26" updated="2012-11-02 16:04:26">
<type id="11">
note</type>
<author id="171588">
BrowserUk</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;i&gt;t won't work... Thread would be terminated, I suppose.&lt;/i&gt;&lt;/blockquote&gt;

&lt;p&gt;Why "suppose"? Did you try it?
&lt;code&gt;
C:\test&gt;perl -Mthreads -E"async{ qx{perl -E\"sleep 5; die q[Now I'm done];\"} }-&gt;detach; select'','','',0.1; die 'I\'m done'"
I'm done at -e line 1.

C:\test&gt;Now I'm done at -e line 1.
&lt;/code&gt;

&lt;p&gt;So long as you give the thread chance to start the command running, it will complete even if the thread dies. 

&lt;p&gt;Ie. &lt;i&gt;"t1.pl runs completely independently of t2.pl"&lt;/i&gt;.

&lt;p&gt;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.

&lt;P&gt;But if I did, on Windows I'd probably use &lt;c&gt;system 1, 't1.pl arg1 arg2 arg3';&lt;/c&gt;



&lt;div class="pmsig"&gt;&lt;div class="pmsig-171588"&gt;
&lt;hr /&gt;
&lt;font size=1 &gt;
&lt;div&gt;With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'&lt;/div&gt;
&lt;div&gt;Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.&lt;/div&gt;
&lt;div&gt;"Science is about questioning the status quo. Questioning authority". &lt;/div&gt;
&lt;div&gt;In the absence of evidence, opinion is indistinguishable from prejudice.
&lt;p align=right&gt; [http://thebottomline.cpaaustralia.com.au/|RIP Neil Armstrong]&lt;/p&gt;&lt;/div&gt;
&lt;/font&gt;

&lt;/div&gt;&lt;/div&gt;
</field>
<field name="root_node">
1002016</field>
<field name="parent_node">
1002034</field>
</data>
</node>
